1

I am struggling to complete this task. I am trying OSMnx which can be used to download data from OSM above however I am getting an error when using its from_polygon feature when trying to download data. Also I am not sure if this data will include Buildings data.

I load my shapefile into geopandas and can then view and interact with it

This is the code

Building_data = ox.graph_from_polygon(my_shapefile, network_type='all')
ox.plot_graph(Building_data)

However I am getting this error

ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().

EDIT: I managed to convert the shapefile into a shapely polygon and run the OSMnx script again,

from shapely.geometry import shape
import fiona
c = fiona.open('E:/shapefile.shp')
pol = c.next()
geom = shape(pol['geometry'])

import osmnx as ox
data = ox.graph_from_polygon(geom, network_type='all')
ox.plot_graph(data)

however now I get this error crs error:

Invalid projection: +proj=utm +zone=80957 +ellps=WGS84 +datum=WGS84 +units=m +no_defs +type=crs: (Internal Proj Error: proj_create: Error -35 (invalid UTM zone number)). 

It seems a shapely polygon has no crs? or the wrong crs?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.