[DOCS-1367] Comment on: "manual/core/2d.txt" Created: 10/Apr/13  Updated: 03/Nov/17  Resolved: 16/Apr/13

Status: Closed
Project: Documentation
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Jeff lee Assignee: Thomas Rueckstiess
Resolution: Done Votes: 0
Labels: collector-298ba4e7
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Location: http://docs.mongodb.org/manual/core/2d/
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31
Referrer: http://docs.mongodb.org/manual/core/geospatial-indexes/
Screen Resolution: 1440 x 900
repo: docs
source: core/2d


Participants:
Days since reply: 10 years, 45 weeks ago

 Description   

Hi,

The 2.4 docs indicate that 2d indexes should be in the order: longitude, latitude.

I'm almost positive that this is the wrong order for 2d indexes. I believe the new order is long/lat for 2dsphere indexes, but that the 2d index order must be lat/long.

Can you confirm?



 Comments   
Comment by Jeff lee [ 10/Apr/13 ]

Ouch...ok. It took me a few re-reads but I think I understand what the original intent was in that documentation.

Thanks for the clarification.

Comment by Fredrik Björk [ 10/Apr/13 ]

The documentation for 2d indexes is correct for 2.2 and above, I think the documentation should be clearer for 2.x and below that the order is lat, lon.

Comment by Thomas Rueckstiess [ 10/Apr/13 ]

Hi Jeff,

The order of arguments is [longitude, latitude] for both 2d and 2dsphere indexes.

The wiki page you linked to is a very old version of the docs. That version of the page appears to be inconsistent, because further down, it also states:

The code assumes that you are using decimal degrees in (X,Y) / (longitude, latitude) order.

If you skip forward in the version history of this page, you will see that a later version has this sentence and the example above fixed: https://wiki.10gen.com/pages/viewpage.action?pageId=22348147

The current v2.2 documentation on the 2d index also states that the order is longitude first, then latitude. This is compliant with the GeoJSON specification.

Let me know if you have any follow-up questions.

Best regards,
Thomas

Comment by Jeff lee [ 10/Apr/13 ]

Found a copy of the old docs:

https://wiki.10gen.com/pages/viewpage.action?pageId=21268125#GeospatialIndexing-CreatingtheIndex

"By default, the index assumes you are indexing latitude/longitude and is thus configured for a [-180..180] value range."

That matches my experience with 2d indexes.

Generated at Thu Feb 08 07:40:52 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.