Skip to content

Changed Earth radius to reflect the constant used by MongoDB #1470

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions source/reference/operator/query/centerSphere.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ $centerSphere
The following example queries grid coordinates and returns all
documents within a 10 mile radius of longitude ``88 W`` and latitude
``30 N``. The query converts the distance to radians by dividing by
the approximate radius of the earth, 3959 miles:
the approximate equatorial radius of the earth, 3963.2 miles:

.. code-block:: javascript

db.places.find( { loc : { $geoWithin :
{ $centerSphere :
[ [ 88 , 30 ] , 10 / 3959 ]
[ [ 88 , 30 ] , 10 / 3963.2 ]
} } } )

.. |operator| replace:: :query:`$centerSphere`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ geometry:
of the sphere (e.g. the Earth) in the units system that you want to
convert the distance to.

The radius of the Earth is approximately ``3,959`` miles or
``6,371`` kilometers.
The radius of the Earth is approximately ``3,963.2`` miles or
``6,378.1`` kilometers.

The following query would return documents from the ``places``
collection within the circle described by the center ``[ -74, 40.74 ]``
Expand All @@ -48,7 +48,7 @@ with a radius of ``100`` miles:
.. code-block:: javascript

db.places.find( { loc: { $geoWithin: { $centerSphere: [ [ -74, 40.74 ] ,
100 / 3959 ] } } } )
100 / 3963.2 ] } } } )

You may also use the ``distanceMultiplier`` option to the
:dbcommand:`geoNear` to convert radians in the :program:`mongod`
Expand Down Expand Up @@ -124,7 +124,7 @@ conversion. The following example uses ``distanceMultiplier`` in the
db.runCommand( { geoNear: "places",
near: [ -74, 40.74 ],
spherical: true,
distanceMultiplier: 3959
distanceMultiplier: 3963.2
} )

The output of the above operation would resemble the following:
Expand Down
6 changes: 3 additions & 3 deletions source/tutorial/query-a-2d-index.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ Use the following syntax:

The following example query returns all documents within a 10-mile
radius of longitude ``88 W`` and latitude ``30 N``. The example converts
distance to radians by dividing distance by the approximate radius of
the earth, 3959 miles:
distance to radians by dividing distance by the approximate equatorial radius of
the earth, 3963.2 miles:

.. code-block:: javascript

db.<collection>.find( { loc : { $geoWithin :
{ $centerSphere :
[ [ 88 , 30 ] , 10 / 3959 ]
[ [ 88 , 30 ] , 10 / 3963.2 ]
} } } )

Proximity to a Point on a Flat Surface
Expand Down
4 changes: 2 additions & 2 deletions source/tutorial/query-a-2dsphere-index.txt
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,12 @@ Use the following syntax:
The following example queries grid coordinates and returns all
documents within a 10 mile radius of longitude ``88 W`` and latitude
``30 N``. The example converts the distance, 10 miles, to radians by
dividing by the approximate radius of the earth, 3959 miles:
dividing by the approximate equatorial radius of the earth, 3963.2 miles:

.. code-block:: javascript

db.places.find( { loc :
{ $geoWithin :
{ $centerSphere :
[ [ 88 , 30 ] , 10 / 3959 ]
[ [ 88 , 30 ] , 10 / 3963.2 ]
} } } )