How to get the coordinates from the GeoJSON format?

716 views
Skip to first unread message

stickupboi

unread,
Oct 2, 2010, 6:39:36 PM10/2/10
to openaddresses
Hi

I'm trying to create a little script that automatically gets
coordinates for a list of adresses.
My script creates an url like
http://www.openaddresses.org/addresses/?queryable=city,housenumber,street&city__ilike=%Lausanne%&housenumber__like=31&street__ilike=%Chemin%20Des%20Fleurettes%&calllback=savecoord

which calls my function savecoord.

My problem is that I don't know how to get out the coordinates from
the response. I guess it looks similar to this:

function savecoord(){
coordpoint = response.features.geometry.coordinates;

}


Anybody here who can help me?

"Hans-Jörg Stark (OpenAddresses.ch)"

unread,
Oct 4, 2010, 10:31:31 AM10/4/10
to openad...@googlegroups.com
try the following:

for (var feature in response.features){
   longitude = feature.geometry.coordinates.0;
   latitude = feature.geometry.coordinates.1; 
}


cheers,
Hans-Jörg
Reply all
Reply to author
Forward
0 new messages