I'm trying to generate an osm map while using smopy but I keep getting the forbidden error, this is the set of the code :

box = (lat[region].min(), lon[region].min(),
       lat[region].max(), lon[region].max())
m = smopy.Map(box, z=12)
m.show_ipython()

and then I get the following error :

HTTPError                                 Traceback (most recent call last)
<ipython-input-48-1060c6eba6aa> in <module>
      1 box = (lat[region].min(), lon[region].min(),
      2        lat[region].max(), lon[region].max())
----> 3 m = smopy.Map(box, z=12)
      4 m.show_ipython()
~\AppData\Roaming\Python\Python37\site-packages\smopy.py in __init__(self, *args, **kwargs)
    290         self.ymin = min(self.box_tile[1], self.box_tile[3])
    291         self.img = None
--> 292         self.fetch()
    293 
    294     def to_pixels(self, lat, lon=None):

~\AppData\Roaming\Python\Python37\site-packages\smopy.py in fetch(self)
    322         """Fetch the image from OSM's servers."""
    323         if self.img is None:
--> 324             self.img = fetch_map(self.box_tile, self.z)
    325         self.w, self.h = self.img.size
    326         return self.img

~\AppData\Roaming\Python\Python37\site-packages\smopy.py in fetch_map(box, z)
     63         for y in range(y0, y1 + 1):
     64             px, py = TILE_SIZE * (x - x0), TILE_SIZE * (y - y0)
---> 65             img.paste(fetch_tile(x, y, z), (px, py))
     66     return img
     67 

~\AppData\Roaming\Python\Python37\site-packages\smopy.py in fetch_tile(x, y, z)
     43     """
     44     url = get_url(x, y, z)
---> 45     png = BytesIO(urlopen(url).read())
     46     img = Image.open(png)
     47     img.load()

~\Anaconda31\lib\urllib\request.py in urlopen(url, data, timeout, cafile, capath, cadefault, context)
    220     else:
    221         opener = _opener
--> 222     return opener.open(url, data, timeout)
    223 
    224 def install_opener(opener):

~\Anaconda31\lib\urllib\request.py in open(self, fullurl, data, timeout)
    529         for processor in self.process_response.get(protocol, []):
    530             meth = getattr(processor, meth_name)
--> 531             response = meth(req, response)
    532 
    533         return response

~\Anaconda31\lib\urllib\request.py in http_response(self, request, response)
    639         if not (200 <= code < 300):
    640             response = self.parent.error(
--> 641                 'http', request, response, code, msg, hdrs)
    642 
    643         return response

~\Anaconda31\lib\urllib\request.py in error(self, proto, *args)
    567         if http_err:
    568             args = (dict, 'default', 'http_error_default') + orig_args
--> 569             return self._call_chain(*args)
    570 
    571 # XXX probably also want an abstract factory that knows when it makes

~\Anaconda31\lib\urllib\request.py in _call_chain(self, chain, kind, meth_name, *args)
    501         for handler in handlers:
    502             func = getattr(handler, meth_name)
--> 503             result = func(*args)
    504             if result is not None:
    505                 return result

~\Anaconda31\lib\urllib\request.py in http_error_default(self, req, fp, code, msg, hdrs)
    647 class HTTPDefaultErrorHandler(BaseHandler):
    648     def http_error_default(self, req, fp, code, msg, hdrs):
--> 649         raise HTTPError(req.full_url, code, msg, hdrs, fp)
    650 
    651 class HTTPRedirectHandler(BaseHandler):

knowing that the code worked perfectly before, I deleted the browser cookies but didn't work and I'm using the latest version of python and anaconda

0 Answers