Example code not working
doggett-sarah opened this issue · 0 comments
Hello, I am trying to run the sprawl-overview example code but I am getting an error when I attempt to retreive the OSM data. Can you help? This is the error message:
JSONDecodeError Traceback (most recent call last)
~\AppData\Local\Continuum\anaconda3\lib\site-packages\osmnx\core.py in overpass_request(data, pause_duration, timeout, error_pause_duration)
337 try:
--> 338 response_json = response.json()
339 if 'remark' in response_json:
~\AppData\Local\Continuum\anaconda3\lib\site-packages\requests\models.py in json(self, **kwargs)
891 pass
--> 892 return complexjson.loads(self.text, **kwargs)
893
~\AppData\Local\Continuum\anaconda3\lib\json_init_.py in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
353 parse_constant is None and object_pairs_hook is None and not kw):
--> 354 return _default_decoder.decode(s)
355 if cls is None:
~\AppData\Local\Continuum\anaconda3\lib\json\decoder.py in decode(self, s, _w)
338 """
--> 339 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
340 end = _w(s, end).end()
~\AppData\Local\Continuum\anaconda3\lib\json\decoder.py in raw_decode(self, s, idx)
356 except StopIteration as err:
--> 357 raise JSONDecodeError("Expecting value", s, err.value) from None
358 return obj, end
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Exception Traceback (most recent call last)
in ()
1 # Retrieve OSM data
2 region_args = {"north":north, "south":south, "west":west, "east":east}
----> 3 df_osm_built, df_osm_building_parts, df_osm_pois = get_processed_osm_data(city_ref, region_args)
~\src\core.py in get_processed_osm_data(city_ref_file, region_args, kwargs)
179 ##########################
180 # Query and update bounding box / polygon
--> 181 df_osm_built, polygon, north, south, east, west = create_buildings_gdf_from_input(date=date_query, polygon=polygon, place=place, which_result=which_result, point=point, address=address, distance=distance, north=north, south=south, east=east, west=west)
182 df_osm_built["osm_id"] = df_osm_built.index
183 df_osm_built.reset_index(drop=True, inplace=True)
~\src\osm\osm_overpass.py in create_buildings_gdf_from_input(date, polygon, place, which_result, point, address, distance, north, south, east, west)
96 p4 = (east,south)
97 polygon = Polygon( [p1,p2,p3,p4] )
---> 98 df_osm_built = buildings_from_polygon(date, polygon)
99 else:
100 log("Error: Must provide at least one input")
~\src\osm\osm_overpass.py in buildings_from_polygon(date, polygon, retain_invalid)
337 """
338
--> 339 return create_buildings_gdf(date=date, polygon=polygon, retain_invalid=retain_invalid)
340
341
~\src\osm\osm_overpass.py in create_buildings_gdf(date, polygon, north, south, east, west, retain_invalid)
235 """
236
--> 237 responses = osm_bldg_download(date, polygon, north, south, east, west)
238
239 vertices = {}
~\src\osm\osm_overpass.py in osm_bldg_download(date, polygon, north, south, east, west, timeout, memory, max_query_area_size)
201 '(poly:"{polygon}")["building"];(._;>;));out;')
202 query_str = query_template.format(polygon=polygon_coord_str, timeout=timeout, maxsize=maxsize)
--> 203 response_json = overpass_request(data={'data':query_str}, timeout=timeout)
204 response_jsons.append(response_json)
205 msg = ('Got all building footprints data within polygon from API in '
~\AppData\Local\Continuum\anaconda3\lib\site-packages\osmnx\core.py in overpass_request(data, pause_duration, timeout, error_pause_duration)
358 else:
359 log('Server at {} returned status code {} and no JSON data'.format(domain, response.status_code), level=lg.ERROR)
--> 360 raise Exception('Server returned no JSON data.\n{} {}\n{}'.format(response, response.reason, response.text))
361
362 return response_json
Exception: Server returned no JSON data.
<Response [400]> Bad Request
The data included in this document is from www.openstreetmap.org. The data is made available under ODbL.
Error: line 1: parse error: ';' expected - ')' found.
Error: line 1: parse error: Unexpected end of input.
Error: line 1: static error: Element "print" cannot be subelement of element "union".