title | description | author | ms.author | ms.date | ms.topic | ms.service | services |
---|---|---|---|---|---|---|---|
Extended GeoJSON geometries | Microsoft Azure Maps |
Learn how Azure Maps extends the GeoJSON spec to include additional geometric shapes. View examples that set up circles and rectangles for use in maps. |
sataneja |
sataneja |
05/17/2018 |
conceptual |
azure-maps |
azure-maps |
Azure Maps provides a list of powerful APIs to search inside and along geographical features. These APIs adhere to the standard GeoJSON spec of representing geographical features.
The GeoJSON spec supports only the following geometries:
- GeometryCollection
- LineString
- MultiLineString
- MultiPoint
- MultiPolygon
- Point
- Polygon
Some Azure Maps APIs accept geometries that aren't part of the GeoJSON spec. For instance, the Search Inside Geometry API accepts Circle and Polygons.
This article provides a detailed explanation on how Azure Maps extends the GeoJSON spec to represent certain geometries.
The Circle
geometry is not supported by the GeoJSON spec. We use a GeoJSON Point Feature
object to represent a circle.
A Circle
geometry represented using the GeoJSON Feature
object must contain the following coordinates and properties:
-
Center
The circle's center is represented using a
GeoJSON Point
object. -
Radius
The circle's
radius
is represented usingGeoJSON Feature
's properties. The radius value is in meters and must be of the typedouble
. -
SubType
The circle geometry must also contain the
subType
property. This property must be a part of theGeoJSON Feature
's properties and its value should be Circle
Here's how you'll represent a circle using a GeoJSON Feature
object. Let's center the circle at latitude: 47.639754 and longitude: -122.126986, and assign it a radius equal to 100 meters:
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [-122.126986, 47.639754]
},
"properties": {
"subType": "Circle",
"radius": 100
}
}
The Rectangle
geometry is not supported by the GeoJSON spec. We use a GeoJSON Polygon Feature
object to represent a rectangle. The rectangle extension is primarily used by the Web SDK's drawing tools module.
A Rectangle
geometry represented using the GeoJSON Polygon Feature
object must contain the following coordinates and properties:
-
Corners
The rectangle's corners are represented using the coordinates of a
GeoJSON Polygon
object. There should be five coordinates, one for each corner. And, a fifth coordinate that is the same as the first coordinate, to close the polygon ring. It will be assumed that these coordinates align, and that the developer may rotate them as wanted. -
SubType
The rectangle geometry must also contain the
subType
property. This property must be a part of theGeoJSON Feature
's properties, and its value should be Rectangle
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [[[5,25],[14,25],[14,29],[5,29],[5,25]]]
},
"properties": {
"subType": "Rectangle"
}
}
Learn more about GeoJSON data in Azure Maps:
[!div class="nextstepaction"] Geofence GeoJSON format
Review the glossary of common technical terms associated with Azure Maps and location intelligence applications:
[!div class="nextstepaction"] Azure Maps glossary