I just need to return the latitude and longitude of my Google Maps marker. I do not want to make a request to Google, nor do I need to display a map with javascript. I need to create markers inside of blog entries and only return the coordinates.

Can the Google Maps plugin do this? Can I pass the lat and lng to text fields when i save the entry?


2 Answers 2


Was out of town so couldn't answer this question until now. With Google Maps for Craft you can do so like this:

{% set marker = entry.yourMapField.getMarker(0) %}

{{ marker.lat }} {{ marker.lng }}

Or you can loop through all the markers on the map like this:

{% for entry in craft.entries.section('news') %}

    {% for marker in entry.yourMapField.getMarkers() %}

        {{ marker.address }}<br>

    {% endfor %}

{% endfor %}



I don’t know about ObjectiveHTML’s Google Maps plugin, but this is easy to do using Lindsey DiLoreto’s Smart Map plugin, which comes with an “Address” field type.

Per the “Using an Address Field” documentation, you can output latitude and longitude values like this:

Latitude: {{ entry.address.lat }}<br />
Longitude: {{ entry.address.lng }}

(In that example, entry is an entry that has an Address field called address.)

  • 1
    Just used Smart Map, the best plugin IMO out there to manage maps.
    – Jason Mayo
    Commented Jun 30, 2015 at 22:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.