Skip to content

Instantly share code, notes, and snippets.

View anujsinghwd's full-sized avatar
🏠
Working from home

Anuj Singh anujsinghwd

🏠
Working from home
View GitHub Profile
@anujsinghwd
anujsinghwd / geo.js
Created November 10, 2021 12:55 — forked from vkarpov15/geo.js
Example of querying a GeoJSON feature collection in MongoDB
db.test.drop();
db.test.insertOne({
name: 'Denver',
location: {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {},
"geometry": {
@anujsinghwd
anujsinghwd / GeoJSON.js
Created December 18, 2021 12:16 — forked from max-mapper/GeoJSON.js
google maps polygon editor
var app = {markers: []};
function serializePolygon(gpoly) {
var gjp = {
"type": "Polygon",
"coordinates": []
};
for (var i = 0; i < gpoly.latLngs.length; i++) {
gjp.coordinates[i] = []
var ring = gpoly.latLngs.getAt(i)
const axios = require('axios');
const fs = require('fs');
const process = async () => {
const response = await axios.get('https://goo.gl/maps/29XfoqKK5s7UdaSy8');
const expression = /window.APP_INITIALIZATION_STATE=\[\[\[\d+.\d+,(\d+.\d+),(\d+.\d+)/
const [,lat, long] = response.data.match(expression)[0].split('[[[')[1].split(',')
console.log({ lat, long})
return { lat, long};