You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A few users have asked how they can explore the camera map without downloading an app.
Let's throw something together with MapBox.js that calls the API to get a list of cameras, then displays them appropriately on the map in a web-browser. We'll give it a theme that fits the rest of the website.
This can replace the front-page image (or, better, only display the image if JS is disabled), and make the site much more immediately immersive.
The text was updated successfully, but these errors were encountered:
So after some experimentation this may be more challenging than we expected. I have a prototype working, but it lags severely if we try to render all of the cameras. Code below:
varmap=newmapboxgl.Map({container: 'map',// container idstyle: 'mapbox://styles/mapbox/light-v8',//stylesheet locationcenter: [0.0,0.0],// starting position, opposite coordinates from Google mapszoom: 1// starting zoom});functionrenderPins(){varxmlHttp=newXMLHttpRequest();xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4&&xmlHttp.status==200){varpins=xmlHttp.responseText.split("\n");pins.forEach(function(pin){varfields=pin.split(", ");if(!isNaN(fields[0])&&!isNaN(fields[1])){newmapboxgl.Marker().setLngLat([fields[1],fields[0]]).addTo(map);}});}}xmlHttp.open("GET","/getPins/0.0/0.0/1",true);// true for asynchronous xmlHttp.send(null);}// if requestIdleCallback supportedif('requestIdleCallback'inwindow){requestIdleCallback(renderPins);}// Oh well, we'll just go for itelse{renderPins();}
On the other hand, I just found this project which appears to do exactly what we want. They've released their code under an extremely permissive license, so we may be able to adapt their code in to website without much work.
A few users have asked how they can explore the camera map without downloading an app.
Let's throw something together with MapBox.js that calls the API to get a list of cameras, then displays them appropriately on the map in a web-browser. We'll give it a theme that fits the rest of the website.
This can replace the front-page image (or, better, only display the image if JS is disabled), and make the site much more immediately immersive.
The text was updated successfully, but these errors were encountered: