-
Notifications
You must be signed in to change notification settings - Fork 0
Structure of GeoJSON
Kumar Damani edited this page Feb 26, 2019
·
3 revisions
Following the GeoJSON spec www.geojson.org, the JSON that we should be passing around must contain at minimum the following 2 fields:
-
type
: STRING, and set this to "Point". -
coordinates
: Array of decimals, where first element is the longitude, second element is the latitude (there is a reason for this).
So the following object would be a good example:
var data = {
"type": "Point",
"coordinates": [-79.0878, 43.0877]
};
Of course you may also add more fields to this object, but they should at minimum contain the two described above, for example:
var data = {
"type": "Point",
"coordinates": [-79.0878, 43.0877],
"age": 45,
"foo": "bar",
"timestamp": <timestamp>
};
would also be valid.