Reputation: 31313
I am new to Azure maps and reading through the documentation.
This blurb describes Points, Features and Shapes.
But it doesn't really help me understand why I would use one over the other. Can someone help me understand the differences and/or point me to some articles that shed light on the subject?
Upvotes: 2
Views: 1152
Reputation: 26751
AzureMaps, like many other map libraries, uses the GeoJSON format to encode geographic data structures.
This format includes Geometry, Feature and FeatureCollection objects.
Geometry:
GeoJSON supports different geometry types:
These geometry types, except for the GeometryCollection, are represented in a Geometry object with the following properties:
type
A GeoJSON type descriptorcoordinates
A collection of coordinatesExample. Point Geometry object:
{
"type": "Point",
"coordinates": [0, 0]
}
The GeometryCollection is also a Geometry object, but with the following properties:
type
A GeoJSON type descriptor with value "GeometryCollection"geometries
A collection of Geometry objectsExample: GeometryCollection Geometry object
{
"type": "GeometryCollection",
"geometries": [
{
"type": "Point",
"coordinates": [0, 0]
},
// N number of Geometry objects
]
}
Feature:
Geometry objects with additional properties are called Feature objects:
type
A GeoJSON type descriptor with value "Feature"geometry
The Geometry objectproperties
N number of additional propertiesExample. Point feature object
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [0, 0]
},
"properties": {
"name": "Null Island"
// N number of additional properties
}
}
Feature collection:
Sets of features are contained by FeatureCollection objects:
type
A GeoJSON type descriptor with value "FeatureCollection"features
A collection of Feature objectsExample. Feature collection with a Point Feature object
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [0, 0]
},
"properties": {
"name": "Null Island"
// N number of additional properties
}
}
// N number of Feature objects
]
}
Shape:
Since GeoJSON objects are only geographic data structures and have no functionality on their own, Azure Maps provides the Shape helper class to make it easy to update and maintain them.
The Shape class wraps a Geometry or a Feature.
Geometry: Base class that constructs a GeoJSON Geometry object.
Feature: Class that constructs a GeoJSON Feature object.
Examples.
Creating a Shape by passing in a Geometry and an object containing properties.
var shape1 = new atlas.Shape(
new atlas.data.Point([0, 0], {
myProperty: 1,
// N number of additional properties
})
)
Creating a Shape using a Feature.
var shape2 = new atlas.Shape(
new atlas.data.Feature(new atlas.data.Point([0, 0]), {
myProperty: 1,
// N number of additional properties
})
)
Upvotes: 3
Reputation: 316
please give this article a try and see if it's helpful. It describes what different geometries are available in the GeoJSON standard and what's point vs shape vs feature.
Upvotes: 3