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

<pre><code>{% set marker = entry.yourMapField.getMarker(0) %}

{{ marker.lat }} {{ marker.lng }}
</code></pre>

<p>Or you can loop through all the markers on the map like this:</p>

<pre><code>{% for entry in craft.entries.section('news') %}

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

        {{ marker.address }}&lt;br&gt;

    {% endfor %}

{% endfor %}
</code></pre>

<p><a href="https://github.com/objectivehtml/Google-Maps-for-Craft/wiki/Getting-Address-From-Map-Markers" rel="nofollow">https://github.com/objectivehtml/Google-Maps-for-Craft/wiki/Getting-Address-From-Map-Markers</a></p>

CC BY-SA 3.0
2015-06-30T20:48:58.877Z
2015-06-30T20:48:58.877Z
Justin Kimbrell
<p>I don’t know about ObjectiveHTML’s Google Maps plugin, but this is easy to do using Lindsey DiLoreto’s <a href="https://craftpl.us/plugins/smart-map/" rel="nofollow">Smart Map</a> plugin, which comes with an “Address” field type.</p>

<p>Per the “<a href="https://craftpl.us/plugins/smart-map/docs/using-an-address-field" rel="nofollow">Using an Address Field</a>” documentation, you can output latitude and longitude values like this:</p>

<pre class="lang-twig prettyprint-override"><code>Latitude: {{ entry.address.lat }}&lt;br /&gt;
Longitude: {{ entry.address.lng }}
</code></pre>

<p>(In that example, <code>entry</code> is an entry that has an Address field called <code>address</code>.)</p>

CC BY-SA 3.0
2015-06-30T22:05:37.993Z
Just used Smart Map, the best plugin IMO out there to manage maps.
Jason Mayo
CC BY-SA 3.0
2015-06-26T18:26:13.587Z
2015-06-26T18:26:13.587Z
Brandon Kelly
<p>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.</p>

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

CC BY-SA 3.0
2015-06-25T02:46:11.290Z
Which google maps plugin are you referring to?
Aaron Berkowitz
CC BY-SA 3.0
2015-06-25T13:51:03.690Z
Google Maps for Craft : https://github.com/objectivehtml/Google-Maps-for-Craft/

I would open to using something else, as long as I could add a marker within the publish page.
SteveO
<plugins>
Google Maps Plugin return coordinates
# Google Maps Plugin return coordinates

(Asked by: username_0 on 2015-06-25)

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?

**Tags:** plugins

> **Comments:**
> **username_1**: Which google maps plugin are you referring to?  
> **username_0**: Google Maps for Craft : https://github.com/objectivehtml/Google-Maps-for-Craft/  I would open to using something else, as long as I could add a marker within the publish page.  

---

## 2 answers

### Answer by username_2 on 2015-06-30. Score: 4

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 }}

    {% endfor %}

{% endfor %}

https://github.com/objectivehtml/Google-Maps-for-Craft/wiki/Getting-Address-From-Map-Markers


---

### Answer by username_3 on 2015-06-26. Score: 3

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 }}
Longitude: {{ entry.address.lng }}

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

> **Comments:**
> **username_4**: Just used Smart Map, the best plugin IMO out there to manage maps.  

---

