Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// Geojson
// Produced by
// 1. Google My Map / Export to KMZ
// 2. Convert KMZ to GeoJSON (using https://mygeodata.cloud/converter/kmz-to-geojson)
// 3. Utilise any helpers below to produce the `output` and, through the console, run copy(JSON.stringify(output))
// Util: polygonToAllowedArea
// Convert a polygon in a Network.settings.AllowedArea ([]{latitude: number, longitude: number})
// Entry: Array[Longitude: number, Latitude: number]
// Note: currently support only first polygon
const polygonToAllowedArea = ({ coordinates }) => coordinates[0].map((lngLat)=>{
return {latitude: lngLat[1], longitude: lngLat[0]};
});
// Util: pointsToMeetingPoints
// Convert a list of GeoJSON features of type "Point" in a Network.settings.meetingPointsData.meetingPoints
// Entry: Array[{geometry: {coordinates: [Longitude: number, Latitude: number]}}]
const pointsToMeetingPoints = features => features.map(({geometry}) => {
return {lat: geometry.coordinates[1], lng: geometry.coordinates[0]};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.