We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trying to pull network object from OSM using the coordinate box but retuned an error indicating no geometry was defined in dataframe.
Operating system: MAC
Python version: 3.9
Pandana version: 0.6.1
Pandana required packages versions (optional): osmnet: .0.1.6
from pandana.loaders import osm network = osm.pdna_network_from_bbox(37.859, -122.282, 37.881, -122.252)
/Users/opt/anaconda3/lib/python3.9/site-packages/geopandas/geodataframe.py:202: UserWarning: Pandas doesn't allow columns to be created via a new attribute name - see https://pandas.pydata.org/pandas-docs/stable/indexing.html#attribute-access super().__setattr__(attr, val) --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) ~/opt/anaconda3/lib/python3.9/site-packages/geopandas/geodataframe.py in crs(self) 430 try: --> 431 return self.geometry.crs 432 except AttributeError: ~/opt/anaconda3/lib/python3.9/site-packages/pandas/core/generic.py in __getattr__(self, name) 5574 return self[name] -> 5575 return object.__getattribute__(self, name) 5576 ~/opt/anaconda3/lib/python3.9/site-packages/geopandas/geodataframe.py in _get_geometry(self) 231 --> 232 raise AttributeError(msg) 233 return self[self._geometry_column_name] AttributeError: You are calling a geospatial method on the GeoDataFrame, but the active geometry column ('geometry') is not present. There are no existing columns with geometry data type. You can add a geometry column as the active geometry column with df.set_geometry. During handling of the above exception, another exception occurred: AttributeError Traceback (most recent call last) ~/opt/anaconda3/lib/python3.9/site-packages/pandas/core/generic.py in __setattr__(self, name, value) 5599 try: -> 5600 existing = getattr(self, name) 5601 if isinstance(existing, Index): ~/opt/anaconda3/lib/python3.9/site-packages/pandas/core/generic.py in __getattr__(self, name) 5574 return self[name] -> 5575 return object.__getattribute__(self, name) 5576 ~/opt/anaconda3/lib/python3.9/site-packages/geopandas/geodataframe.py in crs(self) 432 except AttributeError: --> 433 raise AttributeError( 434 "The CRS attribute of a GeoDataFrame without an active " AttributeError: The CRS attribute of a GeoDataFrame without an active geometry column is not defined. Use GeoDataFrame.set_geometry to set the active geometry column. During handling of the above exception, another exception occurred: ValueError Traceback (most recent call last) /var/folders/8n/1m1r9lls5xd94qn848tmnf9h0000gn/T/ipykernel_1495/228294648.py in <module> 1 from pandana.loaders import osm ----> 2 network = osm.pdna_network_from_bbox(37.859, -122.282, 37.881, -122.252) ~/opt/anaconda3/lib/python3.9/site-packages/pandana/loaders/osm.py in pdna_network_from_bbox(lat_min, lng_min, lat_max, lng_max, bbox, network_type, two_way, timeout, memory, max_query_area_size) 58 "https://udst.github.io/osmnet/") 59 ---> 60 nodes, edges = network_from_bbox(lat_min=lat_min, lng_min=lng_min, 61 lat_max=lat_max, lng_max=lng_max, 62 bbox=bbox, network_type=network_type, ~/opt/anaconda3/lib/python3.9/site-packages/osmnet/load.py in network_from_bbox(lat_min, lng_min, lat_max, lng_max, bbox, network_type, two_way, timeout, memory, max_query_area_size, custom_osm_filter) 844 'lat_min, lng_min, lat_max, and lng_max must be floats' 845 --> 846 nodes, ways, waynodes = ways_in_bbox( 847 lat_min=lat_min, lng_min=lng_min, lat_max=lat_max, lng_max=lng_max, 848 network_type=network_type, timeout=timeout, ~/opt/anaconda3/lib/python3.9/site-packages/osmnet/load.py in ways_in_bbox(lat_min, lng_min, lat_max, lng_max, network_type, timeout, memory, max_query_area_size, custom_osm_filter) 648 """ 649 return parse_network_osm_query( --> 650 osm_net_download(lat_max=lat_max, lat_min=lat_min, lng_min=lng_min, 651 lng_max=lng_max, network_type=network_type, 652 timeout=timeout, memory=memory, ~/opt/anaconda3/lib/python3.9/site-packages/osmnet/load.py in osm_net_download(lat_min, lng_min, lat_max, lng_max, network_type, timeout, memory, max_query_area_size, custom_osm_filter) 135 polygon = Polygon([(lng_max, lat_min), (lng_min, lat_min), 136 (lng_min, lat_max), (lng_max, lat_max)]) --> 137 geometry_proj, crs_proj = project_geometry(polygon, 138 crs={'init': 'epsg:4326'}) 139 ~/opt/anaconda3/lib/python3.9/site-packages/osmnet/load.py in project_geometry(geometry, crs, to_latlong) 443 """ 444 gdf = gpd.GeoDataFrame() --> 445 gdf.crs = crs 446 gdf.name = 'geometry to project' 447 gdf['geometry'] = None ~/opt/anaconda3/lib/python3.9/site-packages/geopandas/geodataframe.py in __setattr__(self, attr, val) 200 object.__setattr__(self, attr, val) 201 else: --> 202 super().__setattr__(attr, val) 203 204 def _get_geometry(self): ~/opt/anaconda3/lib/python3.9/site-packages/pandas/core/generic.py in __setattr__(self, name, value) 5614 stacklevel=find_stack_level(), 5615 ) -> 5616 object.__setattr__(self, name, value) 5617 5618 @final ~/opt/anaconda3/lib/python3.9/site-packages/geopandas/geodataframe.py in crs(self, value) 441 """Sets the value of the crs""" 442 if self._geometry_column_name not in self: --> 443 raise ValueError( 444 "Assigning CRS to a GeoDataFrame without a geometry column is not " 445 "supported. Use GeoDataFrame.set_geometry to set the active " ValueError: Assigning CRS to a GeoDataFrame without a geometry column is not supported. Use GeoDataFrame.set_geometry to set the active geometry column.
The text was updated successfully, but these errors were encountered:
I have the same issue. Built details:
geopandas 0.12.2 pyhd8ed1ab_0 conda-forge hdf5 1.12.2 nompi_ha7af310_101 conda-forge pandana 0.6.1 py39h9d68c2a_1 conda-forge osmnet 0.1.6 py_0 conda-forge python 3.9.16 hea58f1e_0_cpython conda-forge
Sorry, something went wrong.
Issue is the same as this one: #181 and has a work around here: #181 (comment) its an issue with a Pandana dependency, not Pandana itself.
No branches or pull requests
Description of the bug
Trying to pull network object from OSM using the coordinate box but retuned an error indicating no geometry was defined in dataframe.
Environment
Operating system: MAC
Python version: 3.9
Pandana version: 0.6.1
Pandana required packages versions (optional): osmnet: .0.1.6
Paste the code that reproduces the issue here:
Paste the error message (if applicable):
The text was updated successfully, but these errors were encountered: