2

I'm trying to parse the following gml as geopandas dataframe, which did work when trying to parse a csv string as pandas dataframe.

import geopandas as gpd
from io import StringIO

gml = '<gml:MultiPolygon srsName="EPSG:4326"><gml:polygonMember><gml:Polygon>  <gml:outerBoundaryIs><gml:LinearRing><gml:coordinates cs="," ts=" ">-65.84480689655171659,-20.69851241379309315 -65.84480689655171659,-21.53409718390803818 -65.00922212643676801,-20.69851241379309315 -65.74453672413791594,-20.69851241379309315 -65.84480689655171659,-20.69851241379309315</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon>'
sh = gpd.read_file(StringIO(gml))

This however throws the following error

TypeError: Constructor argument must be a file opened in binary mode or bytes/bytearray.

Does anyone have any suggestions how I can parse this gml string to a geopandas dataframe?

Davma
  • 274
  • 5
  • 13
Daan
  • 349
  • 4
  • 16

0 Answers0