Skip to content

Instantly share code, notes, and snippets.

View HeinrichWizardKreuser's full-sized avatar

Heinrich HeinrichWizardKreuser

  • Amazon Web Services
  • Century City, Cape Town, South Africa
View GitHub Profile
@pierdom
pierdom / shapely_to_geojson.py
Created August 17, 2018 08:17
[Convert a shapely Polygon to GeoJson using GeoPandas] from: https://stackoverflow.com/questions/51486454/convert-geopandas-shapely-polygon-to-geojson #python #datascience #gis
In [1]: from shapely.geometry import Point
In [2]: import geopandas as gpd
In [3]: shapely_polygon = Polygon([(0, 0), (0, 1), (1, 0)])
In [4]: gpd.GeoSeries([shapely_polygon]).__geo_interface__
Out[4]:
{'bbox': (0.0, 0.0, 1.0, 1.0),
'features': [{'bbox': (0.0, 0.0, 1.0, 1.0),
'geometry': {'coordinates': (((0.0, 0.0),