points.map(point => { if (point instanceof Array && point.length === 2) { _node.default.GeoPoint._validate(point[1], point[0]); return `(${point[0]}, ${point[1]})`; } if (typeof point !== 'object' || point.__type !== 'GeoPoint') { throw new _node.default.Error(_node.default.Error.INVALID_JSON, 'bad $geoWithin value'); } else { _node.default.GeoPoint._validate(point.latitude, point.longitude); } return `(${point.longitude}, ${point.latitude})`; }).join(', ')
it('geo point roundtrip', async () => { const point = new Parse.GeoPoint(44.0, -11.0); const obj = new TestObject(); obj.set('location', point); obj.set('name', 'Ferndale'); await obj.save(); const result = await new Parse.Query(TestObject).get(obj.id); const pointAgain = result.get('location'); ok(pointAgain); equal(pointAgain.latitude, 44.0); equal(pointAgain.longitude, -11.0); });
describe('GeoLocation', () => { it('should set the geoLocation', async () => { await wd.setGeoLocation(37.4043, -122.0748); const geoLocation = await wd.grabGeoLocation(); assert.equal(geoLocation.latitude, 37.4043, 'The latitude is not properly set'); assert.equal(geoLocation.longitude, -122.0748, 'The longitude is not properly set'); }); });
points.map(point => { if (point instanceof Array && point.length === 2) { Parse.GeoPoint._validate(point[1], point[0]); return point; } if (!GeoPointCoder.isValidJSON(point)) { throw new Parse.Error(Parse.Error.INVALID_JSON, 'bad $geoWithin value'); } else { Parse.GeoPoint._validate(point.latitude, point.longitude); } return [point.longitude, point.latitude]; })
JSONToDatabase(json) { return [json.longitude, json.latitude]; }
describe('#sendLocation', function sendLocationSuite() { before(function before() { utils.handleRatelimit(bot, 'sendLocation', this); }); it('should send a location', function test() { return bot.sendLocation(USERID, lat, long).then(resp => { assert.ok(is.object(resp)); assert.ok(is.object(resp.location)); assert.ok(is.number(resp.location.latitude)); assert.ok(is.number(resp.location.longitude)); }); }); });
this.props.houses.forEach(house => { if (this.houseMarkers[house.id]) { this.houseMarkers[house.id].remove(); } if (house.latitude && house.longitude) { this.houseMarkers[house.id] = leaflet .marker([house.latitude, house.longitude], { icon: leaflet.icon({ iconUrl: '/assets/images/home-icon.png', iconSize: [40, 40], className: style.houseIconImage }) }) .addTo(this.leafletMap); this.markerArray.push(this.houseMarkers[house.id]); } });
addTemporaryConnectedMarker(ip) { let data = window.mods.netstat.geoLookup.get(ip); let geo = (data !== null ? data.location : {}); if (geo.latitude && geo.longitude) { const lat = Number(geo.latitude); const lon = Number(geo.longitude); window.mods.globe.conns.push({ ip, pin: window.mods.globe.globe.addPin(lat, lon, "", 1.2) }); let mark = window.mods.globe.globe.addMarker(lat, lon, '', true); setTimeout(() => { mark.remove(); }, 3000); } }
async updateConOnlineConnection() { let newgeo = window.mods.netstat.ipinfo.geo; newgeo.latitude = Math.round(newgeo.latitude*10000)/10000; newgeo.longitude = Math.round(newgeo.longitude*10000)/10000; if (newgeo.latitude !== this.lastgeo.latitude || newgeo.longitude !== this.lastgeo.longitude) { document.querySelector("i.mod_globe_headerInfo").innerText = `${newgeo.latitude}, ${newgeo.longitude}`; this.removePins(); this.removeMarkers(); //this.addRandomConnectedPoints(); this.conns = []; this._locPin = this.globe.addPin(newgeo.latitude, newgeo.longitude, "", 1.2); this._locMarker = this.globe.addMarker(newgeo.latitude, newgeo.longitude, "", false, 1.2); } this.lastgeo = newgeo; document.querySelector("div#mod_globe").setAttribute("class", ""); }
value.map(geoPoint => [geoPoint.latitude, geoPoint.longitude])
it('supports a sub-object with a geo point', async () => { const point = new Parse.GeoPoint(44.0, -11.0); const obj = new TestObject(); obj.set('subobject', { location: point }); await obj.save(); const query = new Parse.Query(TestObject); const results = await query.find(); equal(results.length, 1); const pointAgain = results[0].get('subobject')['location']; ok(pointAgain); equal(pointAgain.latitude, 44.0); equal(pointAgain.longitude, -11.0); });
JSONToDatabase(json) { return [json.longitude, json.latitude]; }
points.map(point => { if (point instanceof Array && point.length === 2) { Parse.GeoPoint._validate(point[1], point[0]); return point; } if (!GeoPointCoder.isValidJSON(point)) { throw new Parse.Error( Parse.Error.INVALID_JSON, 'bad $geoWithin value' ); } else { Parse.GeoPoint._validate(point.latitude, point.longitude); } return [point.longitude, point.latitude]; })
async updateConOnlineConnection() { let newgeo = window.mods.netstat.ipinfo.geo; newgeo.latitude = Math.round(newgeo.latitude*10000)/10000; newgeo.longitude = Math.round(newgeo.longitude*10000)/10000; if (newgeo.latitude !== this.lastgeo.latitude || newgeo.longitude !== this.lastgeo.longitude) { document.querySelector("i.mod_globe_headerInfo").innerText = `${newgeo.latitude}, ${newgeo.longitude}`; this.removePins(); this.removeMarkers(); //this.addRandomConnectedPoints(); this.conns = []; this._locPin = this.globe.addPin(newgeo.latitude, newgeo.longitude, "", 1.2); this._locMarker = this.globe.addMarker(newgeo.latitude, newgeo.longitude, "", false, 1.2); } this.lastgeo = newgeo; document.querySelector("div#mod_globe").setAttribute("class", ""); }
addTemporaryConnectedMarker(ip) { let data = window.mods.netstat.geoLookup.get(ip); let geo = (data !== null ? data.location : {}); if (geo.latitude && geo.longitude) { const lat = Number(geo.latitude); const lon = Number(geo.longitude); window.mods.globe.conns.push({ ip, pin: window.mods.globe.globe.addPin(lat, lon, "", 1.2) }); let mark = window.mods.globe.globe.addMarker(lat, lon, '', true); setTimeout(() => { mark.remove(); }, 3000); } }