IEEE.org     |     IEEE Xplore Digital Library     |     IEEE Standards     |     IEEE Spectrum     |     More Sites

Commit 500f6e92 authored by jedjas12's avatar jedjas12
Browse files

Testing the negative logic

parent 688d99dd
......@@ -78,14 +78,33 @@ export default class GeoQuery extends LightningElement {
// If you zoom out far enough the world map will start to repeat accross the screan and leaflet
// will return longitudes like 190 degrees for what would technicall be -170
let mlat = (((coord.lat + 90) % 180) - 90);
let mlon = (((coord.lng + 180) % 360) - 180);
if(coord.lat >= 0){ //Works for positive
this.mlat = (((coord.lat + 180) % 360) - 180); //TODO
}
else if(coord.lat < 0){
let absmlat = Math.abs(coord.lng);
console.log(`YOLO: ${absmlat}`);
this.mlat = (((absmlat + 180) % 360) - 180);
this.mlat*=-1;
}
// let mlat = (((coord.lat + 90) % 180) - 90);
if(coord.lng >= 0){ //Works for positive
this.mlon = (((coord.lng + 180) % 360) - 180); //TODO
}
else if(coord.lng < 0){
let absmlon = Math.abs(coord.lng);
this.mlon = (((absmlon + 180) % 360) - 180);
this.mlon*=-1;
}
// Remember where the user actually clicked so we can put the markers in the correct spot
let latOff = Math.trunc(coord.lat / 90);
let lonOff = Math.trunc(coord.lng / 180);
console.log(`Translates to lat: ${mlat} lat offset: ${latOff} lon: ${mlon} lon offset: ${lonOff}`);
console.log(`Translates to lat: ${this.mlat} lat offset: ${latOff} lon: ${this.mlon} lon offset: ${lonOff}`);
// radius in meters
let rad = 100000;
......@@ -102,8 +121,8 @@ export default class GeoQuery extends LightningElement {
// where the user clicked... this should go in a controller module and is only
// here because I was hacking this together for a demo
const distanceURL = new URL(DISTANCE_URL);
distanceURL.searchParams.append('latitude', `${mlat}`);
distanceURL.searchParams.append('longitude', `${mlon}`);
distanceURL.searchParams.append('latitude', `${this.mlat}`);
distanceURL.searchParams.append('longitude', `${this.mlon}`);
distanceURL.searchParams.append('radiusMeters', `${rad}`);
console.log('Getting: ' + distanceURL.href);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment