Skip to content

Instantly share code, notes, and snippets.

@fogonwater
Last active September 15, 2016 02:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fogonwater/340afe26d6aa0ad11a06380f73eb10f2 to your computer and use it in GitHub Desktop.
Save fogonwater/340afe26d6aa0ad11a06380f73eb10f2 to your computer and use it in GitHub Desktop.
Notes on handling elevation with Geojson

There are a couple of approaches to encoding elevation in geojson.

  1. The value for a feature's coordinates key should an array of numbers, which are ordered easting, northing and (optionally) altitude. The array represents a position.
  2. Alternatively, you can make the elevation value one of the feature's properties.

Both approaches are demonstrated below.

{
  "type": "Feature",
  "properties": {
    "name": "Mount Ruapehu",
    "elevation_m": 2797
  },
  "geometry": {
    "type": "Point",
    "coordinates": [
      175.55890560150146,
      -39.28834275351452,
      2797
    ]
  }
}
Display the source blob
Display the rendered blob
Raw
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"name": "Mount Ruapehu",
"elevation_m": 2797
},
"geometry": {
"type": "Point",
"coordinates": [
175.55890560150146,
-39.28834275351452,
2797
]
}
},
{
"type": "Feature",
"properties": {
"name": "Mount Ngauruhoe",
"elevation_m": 2291
},
"geometry": {
"type": "Point",
"coordinates": [
175.63284873962402,
-39.1561465200944,
2291
]
}
},
{
"type": "Feature",
"properties": {
"name": "Mount Tongariro",
"elevation_m": 1978
},
"geometry": {
"type": "Point",
"coordinates": [
175.6347370147705,
-39.13152499104364,
1978
]
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment