Skip to content
New issue

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

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

Closed
BenMatase opened this issue Sep 21, 2017 · 4 comments
Closed

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

BenMatase opened this issue Sep 21, 2017 · 4 comments

Comments

@BenMatase
Copy link

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
Copy link
Owner

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

@BenMatase
Copy link
Author

BenMatase commented Sep 21, 2017

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
Copy link
Author

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
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants