On this page本页内容
MongoDB supports the GeoJSON object types listed on this page.MongoDB支持本页列出的GeoJSON对象类型。
To specify GeoJSON data, use an embedded document with:要指定GeoJSON数据,请使用带有以下内容的嵌入式文档:
type that specifies the GeoJSON object type andtype的字段,指定GeoJSON对象类型,以及coordinates that specifies the object’s coordinates.coordinates的字段,用于指定对象的坐标。
If specifying latitude and longitude coordinates, list the longitude first and then latitude:如果指定纬度和经度坐标,请先列出经度,然后列出纬度:
-180 and 180, both inclusive.-180和180之间(包括-180和180)。-90 and 90, both inclusive.-90和90之间(包括-90和90)。MongoDB geospatial queries on GeoJSON objects calculate on a sphere; MongoDB uses the WGS84 reference system for geospatial queries on GeoJSON objects.MongoDB对GeoJSON对象的地理空间查询在球体上计算;MongoDB使用WGS84参考系统对GeoJSON对象进行地理空间查询。
LineString¶The following example specifies a GeoJSON LineString:
Polygon¶Polygons consist of an array of GeoJSON LinearRing coordinate arrays. These LinearRings are closed LineStrings. Closed LineStrings have at least four coordinate pairs and specify the same position as the first and last coordinates.
The line that joins two points on a curved surface may or may not contain the same set of co-ordinates that joins those two points on a flat surface. The line that joins two points on a curved surface will be a geodesic. Carefully check points to avoid errors with shared edges, as well as overlaps and other types of intersections.
The following example specifies a GeoJSON Polygon with an exterior ring and no interior rings (or holes). The first and last coordinates must match in order to close the polygon:
For Polygons with a single ring, the ring cannot self-intersect.
For Polygons with multiple rings:
The following example represents a GeoJSON polygon with an interior ring:
GeometryCollection¶Requires Versions
The following example stores coordinates of GeoJSON type GeometryCollection: