simplegeo / python-simplegeo

A client interface for SimpleGeo's API.
http://simplegeo.com
104 stars 18 forks source link

Coordinates seem reversed #1

Closed aezell closed 14 years ago

aezell commented 14 years ago

I created a new record with something like this:

alex = simplegeo.Record(layer='com.aezell.test', id=1, lat='36.025776999999998', lon='-86.656917000000007', type='person', name='Alex Ezell')
client.add_record(alex)

yet, when I query for that record, like this:

client.get_record(layer='com.aezell.test', id='1')

the resulting record tells me that the coordinates are:

'coordinates': [-86.656917000000007, 36.025776999999998]

Is it understood that the first value should be lat and the second lon? If so, then line 58 in init.py (the to_dict method) would seem to be the issue. The values should be reversed:

'coordinates': [self.lon, self.lat],
joestump commented 14 years ago

This is expected behavior. We're conforming to the GeoJSON standard, which dictates that we return in lon,lat. Anywhere in the API where we're not conforming to specifications we use lat,lon (which is more widely used).

It's an interesting debate that's been raging in the geo community for quite some time now. Sorry for the confusion. I'll add this to the FAQ.

aezell commented 14 years ago

Thanks for the explanation, Joe. I wasn't aware of the GeoJSON standard. I'll check it out.

joestump commented 14 years ago

Yeah, sorry. We should add this to the docs. GeoRSS is coming soon as well. Actually, it might be in production now (just replace .json with .rss). We'll be supporting a number of GIS serialization standards.

Thanks again! Great feedback!