[GeoJSON] What is the correct way to add a bbox in a GeoJSON object?

Angelo Frozza frozza at gmail.com
Thu Nov 1 08:32:56 PDT 2018


I'm generating some GeoJSON documents and I was unsure how to properly add
a bbox to a geometry.

Do I need to necessarily create a Feature object to add the bbox (example
1) or can I do this in the geometry itself (example 2)?

The GeoSON specification (https://tools.ietf.org/html/rfc7946#appendix-A)
presents examples only with the bbox in a GeoJSON object of type Feature,
however, validators accept the two modes of inserting the bbox.

*Example 1*: In this example, the bbox is an element of the GeoJSON object
of type Feature.

{
  "type": "Feature",
  "properties": {"id": 1, "Linha": null},
  "bbox": [-48.573569106948469, -27.837770518544438,
-48.417446881093412, -27.381161181879751],
  "geometry": {
    "type": "LineString",
    "coordinates": [
      [-48.417446881093412, -27.381161181879751],
      [-48.573569106948469, -27.837770518544438]
    ]
  }
}

*Example 2*: In this other example, the bbox was included directly in the
GeoJSON object with the geometry (LineString).

{
   "type": "LineString",
   "bbox": [-48.573569106948469, -27.837770518544438,
-48.417446881093412, -27.381161181879751],
   "coordinates": [
          [-48.417446881093412, -27.381161181879751],
          [-48.573569106948469, -27.837770518544438]
   ]
}

-- 

-----
Prof. Angelo Augusto Frozza, M.Sc.
angelo.frozza at ifc.edu.br <frozza at ifc.edu.br>
Doutorando PPGCC/UFSC

Professor EBTT
IFC - Instituto Federal Catarinense - Campus Camboriú
http://about.me/tilfrozza

*Sugestões de leitura:*
*NoSQL DAiLY - https://paper.li/TilFrozza/1460718203
<https://paper.li/TilFrozza/1460718203>*
*STARTUP NEWS - http://paper.li/TilFrozza/1392231760
<http://paper.li/TilFrozza/1392231760>*
*A CAVERNA DO MESTRE - http://paper.li/TilFrozza/1392230815
<http://paper.li/TilFrozza/1392230815>*
*RESUMO DA SEMANA - http://paper.li/TilFrozza/1392231274
<http://paper.li/TilFrozza/1392231274>*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.geojson.org/pipermail/geojson-geojson.org/attachments/20181101/19b89c13/attachment.html>


More information about the GeoJSON mailing list