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
15 class OGRGeometry;
16 class OGRPolygon;
17 class OGRSpatialReference;
18
19/************************************************************************/
20/* GeoJSONObject */
21/************************************************************************/
22
23 struct GeoJSONObject
24{
25 enum Type
26 {
27 eUnknown = wkbUnknown, // non-GeoJSON properties
28 ePoint = wkbPoint,
29 eLineString = wkbLineString,
30 ePolygon = wkbPolygon,
31 eMultiPoint = wkbMultiPoint,
32 eMultiLineString = wkbMultiLineString,
33 eMultiPolygon = wkbMultiPolygon,
34 eGeometryCollection = wkbGeometryCollection,
35 eFeature,
36 eFeatureCollection
37 };
38
39 enum CoordinateDimension
40 {
41 eMinCoordinateDimension = 2,
42 eMaxCoordinateDimension = 3
43 };
44};
45
46/************************************************************************/
47/* GeoJSON Geometry Translators */
48/************************************************************************/
49
50GeoJSONObject::Type CPL_DLL OGRGeoJSONGetType(json_object *poObj);
51
52 OGRwkbGeometryType CPL_DLL OGRGeoJSONGetOGRGeometryType(json_object *poObj);
53
54 OGRGeometry CPL_DLL *
55OGRGeoJSONReadGeometry(json_object *poObj,
56 OGRSpatialReference *poParentSRS = nullptr);
57 OGRSpatialReference CPL_DLL *OGRGeoJSONReadSpatialReference(json_object *poObj);
58
59 OGRPolygon *OGRGeoJSONReadPolygon(json_object *poObj, bool bRaw = false);
60
61 const char *OGRGeoJSONGetGeometryName(OGRGeometry const *poGeometry);
62
65#endif
OGRGeometry
Abstract base class for all geometry classes.
Definition ogr_geometry.h:361
OGRPolygon
Concrete class representing polygons.
Definition ogr_geometry.h:2660
OGRSpatialReference
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition ogr_spatialref.h:153
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:407
wkbLineString
@ wkbLineString
1-dimensional geometric object with linear interpolation between Points, standard WKB
Definition ogr_core.h:411
wkbPolygon
@ wkbPolygon
planar 2-dimensional geometric object defined by 1 exterior boundary and 0 or more interior boundarie...
Definition ogr_core.h:413
wkbMultiLineString
@ wkbMultiLineString
GeometryCollection of LineStrings, standard WKB.
Definition ogr_core.h:417
wkbUnknown
@ wkbUnknown
unknown type, non-standard
Definition ogr_core.h:408
wkbPoint
@ wkbPoint
0-dimensional geometric object, standard WKB
Definition ogr_core.h:410
wkbGeometryCollection
@ wkbGeometryCollection
geometric object that is a collection of 1 or more geometric objects, standard WKB
Definition ogr_core.h:420
wkbMultiPolygon
@ wkbMultiPolygon
GeometryCollection of Polygons, standard WKB.
Definition ogr_core.h:419
wkbMultiPoint
@ wkbMultiPoint
GeometryCollection of Points, standard WKB.
Definition ogr_core.h:416