PokemonGoers / PokeMap-2

The world of Pokemon GO is as big as our planet. Pokemons have been sighted on top of cliffs perched over oceans as well as in your next door coffee shop. We would like to create a world-wide interactive map that shows where Pokemons were predicted to appear. Each pokemon prediction you add to the map should have all relevant information including name, time the pokemon is predicted to appear, prediction confidence rate etc. The map should be filtered by a time range (i.e predicted to appear in the next day) as well as pokemon name and pokemon specie.
Apache License 2.0
2 stars 7 forks source link

Map #25

Closed sacdallago closed 8 years ago

sacdallago commented 8 years ago

A thing that just popped to my mind: it would be extremely nice if you gave the users who use your package also the option to specify a different map provider.

Specifically here you would need to change the line from:

L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpandmbXliNDBjZWd2M2x6bDk3c2ZtOTkifQ._QA7i5Mpkd_m30IGElHziw', {

to:

L.tileLayer(tileLayer, {

Also two things:

  1. You are providing your access token in clear text for everyone to read on the globe up there :stuck_out_tongue_winking_eye:
  2. Why are you using mapbox for open street map tiles? Just use OSM or OCM directly! So you don't incur in limitations
            //Using OSM
            var osm = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png');

            //Using OCM
            var ocm = L.tileLayer('http://{s}.tile.opencyclemap.org/transport/{z}/{x}/{y}.png');
egazetic1 commented 8 years ago

Thank you for the tip :)

First branch I made wasn't pulled from the develop branch, so I had to make a new one.

egazetic1 commented 8 years ago

Hi :)

I thought to solve this problem with making a config.js file:

var osm =  'http://{s}.tile.osm.org/{z}/{x}/{y}.png';
var ocm =  'http://{s}.tile.opencyclemap.org/transport/{z}/{x}/{y}.png';

module.exports = 
{
    currentMap : osm
}

And then I will change the line where we set the map to:

L.tileLayer(config.currentMap, .... 
sacdallago commented 8 years ago

This will work for your case, but when people from project E will integrate the map as a package, they will initialize the map with a function or a constructor. Something like:

const map = require('pokeMap');

const options = {
   tileLayer: 'http://{s}.tile.opencyclemap.org/transport/{z}/{x}/{y}.png';
}

map.init(options);

or

const options = {
   tileLayer: 'http://{s}.tile.opencyclemap.org/transport/{z}/{x}/{y}.png';
};

const map = require('pokeMap')(options);

make sure this will work too :)

@PokemonGoers/catch-em-all please correct me if I'm wrong. Should something not be clear, I suggest you talk in person on Monday. The presentation week is usually a game changer for all projects :) Blood is gonna flow, tears are gonna fall, but then everything will work :)

egazetic1 commented 8 years ago

Okay :) I will add it as parameter to the constructor Thank you

johartl commented 8 years ago

I updated https://github.com/PokemonGoers/Catch-em-all/issues/24 accordingly.

egazetic1 commented 8 years ago

Awesome :D

Maybe blood won't flow next week after all :laughing:

sacdallago commented 8 years ago

It always does

harry-wood commented 7 years ago

Just to let you know from an OpenStreetMap point of view "Just use OSM or OCM directly" is not particularly a recommendation. We actively encourage people to use third party map rendering/hosting services such as MapBox as a way of using OpenStreetMap without using the server resources. Using OSM directly (i.e. the "Standard" map style hosted by the not-for-profit volunteer driven OpenStreetMap Foundation) is actually subject to limitations.

That's just a note. Overall I'd say giving people the option to swap between different OpenStreetMap tile hosts is a good move.

You'll also need to change the credit texts accordingly. The little corner text should always credit OpenStreetMap, but you may also be required to mention the tile hosts (which will be configuration dependant for you)

sacdallago commented 7 years ago

Thanks @harry-wood :) I was genuinely unaware of the limitations, sorry :( Sometimes I got annoyed at Mapbox during development, that's why I suggested a more direct approach. But for production (and that's the reason I brought up the option to change provider in the first place) we won't use your servers, but go the Mapbox way.

Btw, I apreciarte the OSM/OCM community immensely for their great work. And: It's been a couple years since I tried this out (and when I did 4 years ago, I failed miserably), but are you aware if by now there is any docker-like way to deploy a tile server? I believe this would be a great resource for developers and lower your bandwidth too :) Also, if the docker instances can be deployed as mirrors for the OSM community to use, it would be a way of paying you back for your hard work :)