Bugfix: Correct latitude & longitude to make them the right way around

This commit is contained in:
Starbeamrainbowlabs 2019-07-25 14:02:16 +01:00
parent 0ff5ca462e
commit 7a96f87b2d
3 changed files with 23 additions and 12 deletions

View File

@ -1,4 +1,6 @@
@import "../../node_modules/leaflet/dist/leaflet.css";
.leaflet-fade-anim .leaflet-tile,.leaflet-zoom-anim .leaflet-zoom-animated { will-change:auto !important; }
/** Ensure that some assets are copied that aren't by default **/
.non-existent {
background: url(../../node_modules/leaflet/dist/images/marker-icon-2x.png),

View File

@ -9,10 +9,16 @@ export default {
default_zoom: 12,
// The border around gateways that we should consult the AI on.
border: 0.1,
border: {
lat: 0.05,
lng: 0.1
},
// The resolution of the coverage map
step: 0.005,
step: {
lat: 0.003,
lng: 0.005,
},
colour_scale: {
min: "#ffffff",

View File

@ -51,10 +51,13 @@ class LayerAI {
this.layer = this.generate_layer();
this.layer.addTo(this.map);
console.log("[Layer/AI] Complete");
}
generate_layer() {
console.log("[Layer/AI] Rendering map");
let map = this.render_map();
console.log("[Layer/AI] Passing to Leaflet");
return L.geoJSON(map, {
style: (feature) => { return {
stroke: true,
@ -70,11 +73,11 @@ class LayerAI {
render_map() {
// FUTURE: Do this in a web worker?
let map_bounds = this.gateway_bounds;
map_bounds.north += Config.border;
map_bounds.south -= Config.border;
map_bounds.north += Config.border.lat;
map_bounds.south -= Config.border.lat;
map_bounds.east += Config.border;
map_bounds.west -= Config.border;
map_bounds.east += Config.border.lng;
map_bounds.west -= Config.border.lng;
let coverage = [],
colour_scale = chroma.scale([
@ -85,8 +88,8 @@ class LayerAI {
this.index.properties.rssi_max
);
for(let lat = map_bounds.west; lat < map_bounds.east; lat += Config.step) {
for(let lng = map_bounds.south; lng < map_bounds.north; lng += Config.step) {
for(let lat = map_bounds.south; lat < map_bounds.north; lat += Config.step.lat) {
for(let lng = map_bounds.west; lng < map_bounds.east; lng += Config.step.lng) {
let max_predicted_rssi = -Infinity;
for(let [, ai] of this.gateways) {
@ -113,10 +116,10 @@ class LayerAI {
type: "Polygon",
coordinates: [
[ // Outer shape
[lat, lng],
[lat + Config.step, lng],
[lat + Config.step, lng + Config.step],
[lat, lng + Config.step]
[lng, lat],
[lng, lat + Config.step.lat],
[lng + Config.step.lng, lat + Config.step.lat],
[lng + Config.step.lng, lat]
]
// If there were any holes in the shape, we'd put them here
]