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
I encountered an error while creating a map with the origin at lat=10.716271, long=106.684051.
lat=10.716271, long=106.684051
here is how to replicate it
from promis.geo import PolarLocation, LocationType from promis.loaders import OsmLoader from overpy.exception import OverpassGatewayTimeout, OverpassTooManyRequests origin = PolarLocation(latitude=10.716271, longitude=106.684051) dimensions = (1000.0, 1000.0) map = None while map is None: try: map = OsmLoader().load_polar( origin=origin, width=dimensions[0], height=dimensions[1] ) except (OverpassGatewayTimeout, OverpassTooManyRequests): print(f"OSM query failed, sleeping {timeout}s...") sleep(timeout)
error log:
{ "name": "AttributeError", "message": "'NoneType' object has no attribute 'get'", "stack": "--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Cell In[3], line 9 7 while map is None: 8 try: ----> 9 map = OsmLoader().load_polar( 10 origin=origin, width=dimensions[0], height=dimensions[1] 11 ) 12 except (OverpassGatewayTimeout, OverpassTooManyRequests): 13 print(f\"OSM query failed, sleeping {timeout}s...\") File ...venvPromis\\lib\\site-packages\\promis\\loaders\\osm_loader.py:43, in OsmLoader.load_polar(self, origin, width, height) 33 bounding_box = f\"({south:.4f}, {west:.4f}, {north:.4f}, {east:.4f})\" 35 # Return map with currently hardcoded features 36 return PolarMap( 37 origin, 38 width, 39 height, 40 self.load_polygons( 41 \"'leisure' = 'park'\", bounding_box, LocationType.PARK, is_way=True, is_relation=True 42 ) ---> 43 + self.load_polygons( 44 \"'natural' = 'water'\", 45 bounding_box, 46 LocationType.WATER, 47 is_way=True, 48 is_relation=True, 49 ) 50 + self.load_polygons(\"'natural' = 'bay'\", bounding_box, LocationType.BAY, is_way=True) 51 + self.load_polygons(\"'building'\", bounding_box, LocationType.BUILDING, is_way=True) 52 + self.load_routes(\"'highway' = 'residential'\", bounding_box, LocationType.RESIDENTIAL) 53 + self.load_routes(\"'highway' = 'primary'\", bounding_box, LocationType.PRIMARY) 54 + self.load_routes(\"'highway' = 'secondary'\", bounding_box, LocationType.SECONDARY) 55 + self.load_routes(\"'highway' = 'tertiary'\", bounding_box, LocationType.TERTIARY) 56 + self.load_routes(\"'highway' = 'footway'\", bounding_box, LocationType.FOOTWAY) 57 + self.load_routes(\"'highway' = 'service'\", bounding_box, LocationType.SERVICE) 58 + self.load_routes(\"'railway' = 'rail'\", bounding_box, LocationType.RAIL) 59 + self.load_routes(\"'footway' = 'crossing'\", bounding_box, LocationType.CROSSING), 60 ) File ...venvPromis\\lib\\site-packages\\promis\\loaders\\osm_loader.py:169, in OsmLoader.load_polygons(self, tag, bounding_box, location_type, is_way, is_relation) 155 # Load data via Overpass 156 way_result = ( 157 self.overpass_api.query( 158 f\"\"\" (...) 165 else None 166 ) 168 relation_result = ( --> 169 self.overpass_api.query( 170 f\"\"\" 171 [out:json]; 172 relation[{tag}]{bounding_box}; 173 out geom{bounding_box};>;out; 174 \"\"\" 175 ) 176 if is_relation 177 else None 178 ) 180 # Construct and return list of PolarPolygon 181 relation_polygons = ( 182 [ 183 self.relation_to_polygon(relation, location_type=location_type) (...) 187 else [] 188 ) File ...venvPromis\\lib\\site-packages\\overpy\\__init__.py:149, in Overpass.query(self, query) 146 content_type = f.getheader(\"Content-Type\") 148 if content_type == \"application/json\": --> 149 return self.parse_json(response) 151 if content_type == \"application/osm3s+xml\": 152 return self.parse_xml(response) File ...venvPromis\\lib\\site-packages\\overpy\\__init__.py:214, in Overpass.parse_json(self, data, encoding) 212 if \"remark\" in data_parsed: 213 self._handle_remark_msg(msg=data_parsed.get(\"remark\")) --> 214 return Result.from_json(data_parsed, api=self) File ...venvPromis\\lib\\site-packages\\overpy\\__init__.py:365, in Result.from_json(cls, data, api) 363 e_type = element.get(\"type\") 364 if hasattr(e_type, \"lower\") and e_type.lower() == elem_cls._type_value: --> 365 result.append(elem_cls.from_json(element, result=result)) 367 return result File ...venvPromis\\lib\\site-packages\\overpy\\__init__.py:1131, in Relation.from_json(cls, data, result) 1128 for member_cls in supported_members: 1129 if member_cls._type_value == type_value: 1130 members.append( -> 1131 member_cls.from_json( 1132 member, 1133 result=result 1134 ) 1135 ) 1137 attributes = {} 1138 ignore = [\"id\", \"members\", \"tags\", \"type\"] File ...venvPromis\\lib\\site-packages\\overpy\\__init__.py:1279, in RelationMember.from_json(cls, data, result) 1275 geometry = [] 1276 for v in geometry_orig: 1277 geometry.append( 1278 RelationWayGeometryValue( -> 1279 lat=v.get(\"lat\"), 1280 lon=v.get(\"lon\") 1281 ) 1282 ) 1283 else: 1284 geometry = None AttributeError: 'NoneType' object has no attribute 'get'" }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I encountered an error while creating a map with the origin at
lat=10.716271, long=106.684051
.here is how to replicate it
error log:
The text was updated successfully, but these errors were encountered: