Get lat and lon values of CCK Location field
towlie - October 9, 2009 - 11:40
| Project: | Location |
| Version: | 6.x-3.x-dev |
| Component: | Location_views |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | fixed |
Jump to:
Description
Hi,
I want to use the CCK Location Field in order to set map.setCenter of Google Maps I'm displaying via Contemplates in nodes. All I can find in Contemplates is
<?php
print $node->field_location[0]['view']
?>Germany
51° 24' 46.4832" N, 10° 10' 24.024" E
See map: Google MapsIs it possible to get the values of latitude and longitude separately, like 51.412912 and 10.17334?

#1
Hi,
I found the answer :
$lat = $field_location[0]['latitude'];
$long = $field_location[0]['longitude'];
"location" is the name of my field.
Hope it will help!
#2
It helped,
I now use 'computed field' to fill the lat and lon values to a different cck field.
Thanks.
#3
Moving this to the documentation project documentation/faq/help so that we don't loose any vital information collected here.