modrzew / pokeminer

Pokemon location scraper
MIT License
220 stars 62 forks source link

How to change the leaflet map to another #264

Closed tcrouch199205 closed 7 years ago

tcrouch199205 commented 7 years ago

As the title suggests, I'm looking at changing the default leaflet map to a hybrid map. In the config, we are provided with "MAP_PROVIDER_URL" and "MAP_PROVIDER_ATTRIBUTION", however the hybrid map has more to it than just those two. The one I'm interested in switching to is HERE.HybridDay, and I can not seem to figure it out.

leclaida commented 7 years ago

for it to function you only need to change the url. i've never used here, but after scanning their documents it looks easy enough. copy and paste the url from that link you sent (the one with {x}, {y}, {z}). fill in app id and all the other things by registering with HERE.

go here: https://github.com/leaflet-extras/leaflet-providers

then scroll to providers requiring registration.

tcrouch199205 commented 7 years ago

I've gotten the url set up with the proper app id and app code. When running the scanner the map doesn't load images, and instead it shows a grid filled with unloaded image icons.

leclaida commented 7 years ago

can you paste here what you are putting into your config file?

tcrouch199205 commented 7 years ago

I'm using

MAP_PROVIDER_URL = 'https://1.aerial.maps.cit.api.here.com/maptile/2.1/maptile/newest/hybrid.day/13/4400/2686/256/png8?app_id={YOUR_APP_ID}&app_code={YOUR_APP_CODE}'

I've also replaced the {YOUR_APP_ID} and {YOUR_APP_CODE} with the appropriate information.

leclaida commented 7 years ago

try:

MAP_PROVIDER_URL= '//{s}.aerial.maps.cit.api.here.com/maptile/2.1/maptile/newest/hybrid.day/{z}/{x}/{y}/256/png8?app_id={app_id}&app_code={app_code}&lg=eng

fill in your app id and app code.

tcrouch199205 commented 7 years ago

Trying what you provided still leads the a map filled with unloaded image icons. I'm starting to wonder if it's on HERE's side and not on anything that I might be doing.

leclaida commented 7 years ago

so i made my own app id and app code so i could see what was happening. turns out the url isnt being passed correctly because of the &

i'm not familiar with how to escape the & in python, but you can still use your map if you open up newmap.html (using notepad++ or something similar). scroll to the bottom and you should see: L.tilelayer(' {{MAP_PROVIDER ' )

replace that so that you have:

L.tilelayer('//1.aerial.maps.cit.api.here.com/maptile/2.1/maptile/newest/hybrid.day/{z}/{x}/{y}/256/png8?app_id={app_id}&app_code={app_code}', [OTHER STUFF])

Aiyubi commented 7 years ago

let me guess: you guys are using python2.7 ? You could also try to set the string to unicode like: MAP_PROVIDER_URL= u'your_url' (note the u, did not test this)

tcrouch199205 commented 7 years ago

Alright, I've gotten it to work by replacing that bit of code in the newmap.html. Thanks for all your help!