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 print $node->field_location[0]['view'] (I named the CCK field 'location'), which displays the whole location, such as

Germany
51° 24' 46.4832" N, 10° 10' 24.024" E
See map: Google Maps

Is it possible to get the values of latitude and longitude separately, like 51.412912 and 10.17334?

Comments

yoda-fr’s picture

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!

Robert Molenaar’s picture

It helped,

I now use 'computed field' to fill the lat and lon values to a different cck field.

Thanks.

nickl’s picture

Status: Active » Fixed

Moving this to the documentation project documentation/faq/help so that we don't loose any vital information collected here.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.