GDAL

ogrgeojsongeometry.h
1// SPDX-License-Identifier: MIT
2// Copyright 2007, Mateusz Loskot
3// Copyright 2008-2024, Even Rouault <even.rouault at spatialys.com>
4
5#ifndef OGRGEOJSONGEOMETRY_H_INCLUDED
6#define OGRGEOJSONGEOMETRY_H_INCLUDED
7
10#include "cpl_port.h"
11#include "cpl_json_header.h"
12
13#include "ogr_api.h"
14#include "ogr_geometry.h"
15
16/************************************************************************/
17/* GeoJSONObject */
18/************************************************************************/
19
20 struct GeoJSONObject
21{
22 enum Type
23 {
24 eUnknown = wkbUnknown, // non-GeoJSON properties
25 ePoint = wkbPoint,
26 eLineString = wkbLineString,
27 ePolygon = wkbPolygon,
28 eMultiPoint = wkbMultiPoint,
29 eMultiLineString = wkbMultiLineString,
30 eMultiPolygon = wkbMultiPolygon,
31 eGeometryCollection = wkbGeometryCollection,
32 eCircularString = wkbCircularString, // JSON-FG extension
33 eCompoundCurve = wkbCompoundCurve, // JSON-FG extension
34 eCurvePolygon = wkbCurvePolygon, // JSON-FG extension
35 eMultiCurve = wkbMultiCurve, // JSON-FG extension
36 eMultiSurface = wkbMultiSurface, // JSON-FG extension
37 eFeature,
38 eFeatureCollection
39 };
40
41 enum CoordinateDimension
42 {
43 eMinCoordinateDimension = 2,
44 eMaxCoordinateDimensionGeoJSON = 3,
45 eMaxCoordinateDimensionJSONFG = 4,
46 };
47};
48
49/************************************************************************/
50/* GeoJSON Geometry Translators */
51/************************************************************************/
52
53GeoJSONObject::Type CPL_DLL OGRGeoJSONGetType(json_object *poObj);
54
55 bool CPL_DLL OGRJSONFGHasMeasure(json_object *poObj, bool bUpperLevelMValue);
56
57 OGRwkbGeometryType CPL_DLL OGRGeoJSONGetOGRGeometryType(json_object *poObj,
58 bool bHasM);
59
60std::unique_ptr<OGRGeometry>
61 CPL_DLL OGRGeoJSONReadGeometry(json_object *poObj, bool bHasM,
62 const OGRSpatialReference *poParentSRS);
63
64 OGRSpatialReference CPL_DLL *OGRGeoJSONReadSpatialReference(json_object *poObj);
65
66std::unique_ptr<OGRPolygon> OGRGeoJSONReadPolygon(json_object *poObj,
67 bool bHasM, bool bRaw);
68
69 const char *OGRGeoJSONGetGeometryName(OGRGeometry const *poGeometry);
70
73#endif
OGRGeometry
Abstract base class for all geometry classes.
Definition ogr_geometry.h:357
OGRSpatialReference
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition ogr_spatialref.h:152
cpl_port.h
Core portability definitions for CPL.
ogr_api.h
C API and defines for OGRFeature, OGRGeometry, and OGRDataSource related classes.
OGRwkbGeometryType
OGRwkbGeometryType
List of well known binary geometry types.
Definition ogr_core.h:405
wkbLineString
@ wkbLineString
1-dimensional geometric object with linear interpolation between Points, standard WKB
Definition ogr_core.h:409
wkbCircularString
@ wkbCircularString
one or more circular arc segments connected end to end, ISO SQL/MM Part 3.
Definition ogr_core.h:421
wkbPolygon
@ wkbPolygon
planar 2-dimensional geometric object defined by 1 exterior boundary and 0 or more interior boundarie...
Definition ogr_core.h:411
wkbMultiLineString
@ wkbMultiLineString
GeometryCollection of LineStrings, standard WKB.
Definition ogr_core.h:415
wkbUnknown
@ wkbUnknown
unknown type, non-standard
Definition ogr_core.h:406
wkbPoint
@ wkbPoint
0-dimensional geometric object, standard WKB
Definition ogr_core.h:408
wkbCompoundCurve
@ wkbCompoundCurve
sequence of contiguous curves, ISO SQL/MM Part 3.
Definition ogr_core.h:423
wkbGeometryCollection
@ wkbGeometryCollection
geometric object that is a collection of 1 or more geometric objects, standard WKB
Definition ogr_core.h:418
wkbMultiPolygon
@ wkbMultiPolygon
GeometryCollection of Polygons, standard WKB.
Definition ogr_core.h:417
wkbMultiPoint
@ wkbMultiPoint
GeometryCollection of Points, standard WKB.
Definition ogr_core.h:414
wkbCurvePolygon
@ wkbCurvePolygon
planar surface, defined by 1 exterior boundary and zero or more interior boundaries,...
Definition ogr_core.h:425
wkbMultiSurface
@ wkbMultiSurface
GeometryCollection of Surfaces, ISO SQL/MM Part 3.
Definition ogr_core.h:430
wkbMultiCurve
@ wkbMultiCurve
GeometryCollection of Curves, ISO SQL/MM Part 3.
Definition ogr_core.h:428
ogr_geometry.h
Simple feature geometry classes.