Originally this project started out as a simple map to identify gyms in park. Over time it grew to be a useful collection of data points as well as for analysis. Therefore I am adapting this into a more general purpose mapping site that can be easily extended to other areas.
all.geojson
hosted somewhere (I use Github Gists and Rawgit)The data sources are in the geoJSON format as it allows for:
properties
key)The rationale behind this data format is to front-load expensive geographical calculations beforehand, so that the map, its markers and overlays can be (re-)rendered and filtered as quickly as possible for a seamless user experience.
all.geojson
Plotting an S2 grid is quite straightforward thanks to this widespread tool. Using it programmatically however, is what I'm going to cover.
s2.geojson
There is not much to change. There are chiefly 3 files of concern:
index.html
index.js
fetchLocal
to use your own data sources for all.geojson
and s2.geojson
respectively. I used the function back when I was doing fine without jQuery. Now you can just replace with it $.get
I guess. I don't use fetch as I prefer not to have to polyfill it for older browsers.compiled.js
index.js
, for browser compatibility. yarn
to install required packages (also for linting and code formatting)yarn build
, which also starts in watch mode and changes compiled.js
as you edit index.js
.Please add an attribution link back to this repository if you are copying my site code, so people can contact me about my code if needed.
<a href="https://github.com/xiankai/sg-pokemongo-ex-raid-map">Original source</a>
Simply load index.html
in your browser. A file:///
URL works fine as long you are hosting the data sources elsewhere, otherwise Chrome doesn't allow network calls for the file:///
scheme.