Skip to main content
8 of 8
deleted 78 characters in body
user2856
  • 69.6k
  • 6
  • 119
  • 203

You pass the geojson string directly to the gdal OpenEx function.

In python it's just:

# GDAL 2+
ds = gdal.OpenEx('some geojson string')


# GDAL 1.11
ds = ogr.Open('some geojson string')

An example to demonstrate:

from osgeo import gdal

geojson = '{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"type":"Point","coordinates":[146.7,-41.9]}}]}'
ds = gdal.OpenEx(geojson)
layer = ds.GetLayer()
feature = layer.GetFeature(0)

print(ds.GetDriver().ShortName)
print(feature.GetGeometryRef().ExportToWkt())

Output:

GeoJSON
POINT (146.7 -41.9)
user2856
  • 69.6k
  • 6
  • 119
  • 203