List of cities to convert latitude and longitude

1,642 views
Skip to first unread message

Jnew

unread,
Jan 13, 2011, 6:17:11 PM1/13/11
to Google Maps JavaScript API v3
http://maps.google.com/maps/api/geocode/json?address=londrina,pr&sensor=false


I have a list of 150 cities, and would like to get the latitude and
longitude of them all. There is an automatic way of doing this, not
having to type each one in the url?
Then I'll enter these values in the marker with the Google Maps API.

var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title:"Uluru (Ayers Rock)"
});

For now, I'm using the function insert below, to automatically
convert, but is not carrying all the markers. Carries only about 30
markers and I think the problem is due to conversion to latitude /
longitude in the script.

What do you think?

FUNCTION CODE

function addAddressToMap(response) {
if (!response || response.Status.code != 200) {
//alert("Sorry, we were unable to geocode that address");
} else {
place = response.Placemark[0];
point = new GLatLng(place.Point.coordinates[1],
place.Point.coordinates[0]);

var marker = new GMarker(point);
GEvent.addListener(marker, "click", function() {
html = document.getElementById("map_canvas").value;
marker.openInfoWindowHtml(html + place.address + '<br>')
});
map.addOverlay(marker);
}
}

geoco...@gmail.com

unread,
Jan 13, 2011, 6:57:55 PM1/13/11
to Google Maps JavaScript API v3
On Jan 13, 3:17 pm, Jnew <idn...@gmail.com> wrote:
> http://maps.google.com/maps/api/geocode/json?address=londrina,pr&sens...
>
> I have a list of 150 cities, and would like to get the latitude and
> longitude of them all. There is an automatic way of doing this, not
> having to type each one in the url?

Have you seen this?
http://blog.pamelafox.org/2008/11/geocoding-with-google-spreadsheets-and.html

-- Larry

> Then I'll enter these values in the marker with the Google Maps API.
>
>
> For now, I'm using the function insert below, to automatically
> convert, but is not carrying all the markers. Carries only about 30
> markers and I think the problem is due to conversion to latitude /
> longitude in the script.
>
> What do you think?

I think the geocoder is asynchronous, and subject to a quota and rate
limiting.
http://code.google.com/apis/maps/faq.html#geocoder_limit

>

PaulG

unread,
Jan 14, 2011, 5:07:59 AM1/14/11
to Google Maps JavaScript API v3
Its probably worth mentioning Google Fusion Tables has the ability to
do this geocoding for you too, and you can export the full results, or
subsets of the results as kml.

This is expecially useful if your cities are each associated with,say,
a state (or any other criteria) so you could query the Fusion Table
like a database and fetch kml back.

Jnew

unread,
Jan 14, 2011, 2:42:22 PM1/14/11
to Google Maps JavaScript API v3
Now yes, then confirmed, is perfect.

I managed to load all latitudes automatically and easily with the
gadget for google docs and loading by latitude and longitude (in
google maps script) displays all the cities and much more quickly.

Thank you very much.


On 13 jan, 21:57, "geocode...@gmail.com" <geocode...@gmail.com> wrote:
> On Jan 13, 3:17 pm, Jnew <idn...@gmail.com> wrote:
>
> >http://maps.google.com/maps/api/geocode/json?address=londrina,pr&sens...
>
> > I have a list of 150 cities, and would like to get the latitude and
> > longitude of them all. There is an automatic way of doing this, not
> > having to type each one in the url?
>
> Have you seen this?http://blog.pamelafox.org/2008/11/geocoding-with-google-spreadsheets-...

sophie

unread,
Feb 4, 2011, 5:32:29 AM2/4/11
to google-map...@googlegroups.com
Hello!! I'm making a project for my school. I want to enter to 2 textboxes the longitude and the latitude and with clicking a button placea marker to that spot. Can anybody help me?

Shreerang Patwardhan

unread,
Feb 4, 2011, 5:44:53 AM2/4/11
to google-map...@googlegroups.com
Have a look at the following links!

http://shreerangpatwardhan.blogspot.com/2010/11/form-info-window.html

http://shreerangpatwardhan.blogspot.com/2010/11/only-information-bubbles.html


Hope this helps!

On Fri, Feb 4, 2011 at 4:02 PM, sophie <sofiap...@yahoo.gr> wrote:
Hello!! I'm making a project for my school. I want to enter to 2 textboxes the longitude and the latitude and with clicking a button placea marker to that spot. Can anybody help me?

--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
To post to this group, send email to google-map...@googlegroups.com.
To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.



--
Regards,
Shreerang Patwardhan.
Reply all
Reply to author
Forward
0 new messages