cvalenzuela / Mappa

A canvas wrapper for Maps 🗺 🌍
https://mappa.js.org
360 stars 104 forks source link

Example on the bottom of the README doesn't work #5

Closed BenMatase closed 7 years ago

BenMatase commented 7 years ago

I tried cloning the repo and copying the code of the map colored each country a different shade of blue. I get two TypeErrors when inspect the page that says "Loading..." on Chrome an go to the Console output.

mappa.js:643 Uncaught TypeError: _staticMap[this.provider] is not a constructor
    at Mappa.staticMap (mappa.js:643)
    at script.js:14
script.js:21 Uncaught TypeError: Cannot read property 'imgUrl' of undefined
    at preload (script.js:21)
    at e.<anonymous> (p5.min.js:6)
    at new e (p5.min.js:6)
    at e (p5.min.js:5)
cvalenzuela commented 7 years ago

thanks for the catch! A wrong map provider was set in that example. I just updated it to reflect the changes

BenMatase commented 7 years ago

That seemed to remove the issue I was having before, but now I'm running into a different issue, but it seems something more about my setup. Any guidance to get the visualization to display?


mappa.js:756 You requested an image with a height of 800px. Google Maps Static API max height value is 640px. For larger images, change the scale to 2 and keep the height between 1-640px. i.e: if you want an image 800x800px, set the width and height to 400x400 and the scale to 2.
size @ mappa.js:756
p5.min.js:8 Fetch API cannot load file:///home/ben/Mappa/examples/tile/Google/data/world.geojson. URL scheme must be "http" or "https" for CORS request.
h.httpDo @ p5.min.js:8
p5.min.js:8 Uncaught (in promise) TypeError: Failed to fetch
    at Object.h.httpDo (p5.min.js:8)
    at e.h.loadJSON (p5.min.js:8)
    at e.<anonymous> (p5.min.js:6)
    at preload (script.js:40)
    at e.<anonymous> (p5.min.js:6)
    at new e (p5.min.js:6)
    at e (p5.min.js:5)

I just edited the size of the image and that got rid of the first part. I'm going to try hosting it somewhere else to see if that fixes the second part.

BenMatase commented 7 years ago

I seem to have fixed it by hosting it on a web server so that it has access to HTTP something or other. Thank you for the help!

cvalenzuela commented 7 years ago

Yes, you need to set up a server for that. Check out this tutorial for setting up a local server.