[support] Google map in cck node

Pavan Keshavamurthy pavan.k.murthy at gmail.com
Thu Jun 11 14:57:41 UTC 2009


I do this on some old 5.x app: It can't be too different for 6.x

<?php
/*
*  id - the id of the map every map on a page must have a unique id
*  width - width of the map
*  height - height of the map
*  center - a string of the longitude and latitude of the centre of the map
*  zoom - the zoom factor of the google map
*  align - the alignment of the map 'right', 'left' or 'center'
*  control - the control shown on the map 'Large', 'Small', or 'None'
*  type - 'Map', 'Hybrid' or 'Satellite'
*  points/markers - a string of points to mark on the map with + between each 
point
*/
    $points = array(
            'id' => 'map'.$node->nid,
            'width' => '500px',
            'height' => '250px',
            'latitude' => $location['latitude'],
            'longitude'=> $location['longitude'],
            'zoom' => 14,
            'maptype' => 'Map',
            'markers' => array(array(
                    'markername' => 'orange',
              'latitude' => $location['latitude'],
              'longitude' => $location['longitude']
          ))
        );
    print theme('gmap', array('#settings' => $points));
    ?>
</div>
<?php } ?>

Best
Pavan Keshavamurthy

You could code this into your node template or perhaps use contemplate.
On Thursday 11 June 2009 14:40:38 sivaji j.g wrote:
> I have been struggling with gmap and location module. I have a custom
> node type called user_info which integrates with location module i.e
> it lets you to enter street name, city, country etc. and to choose
> latitude and longitude from google map.
>
> In the node full view i could see the input street name, city, country
> and latitude and latitude generated from google map but no google map
> been displayed here.
>
> After searching on google i came to know that i am suppose to generate
> gmap marco from "map/macro" url ( which looks something like [gmap
> zoom=12 |center=32.82421110161336, -96.77650451660156 |width=500px
>
> |height=400px |control=Small |type=Map]) and enter it in node body
>
> field. is it the way it works ? is it not possible to automatically
> map from location field input and display it in node view ?

-- 
-Pavan K Murthy
http://grahana.net/


More information about the support mailing list