Created
September 12, 2018 11:05
-
-
Save LouisaKB/9734316f1b4f85538bfc5561703fe2eb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function shapesToMultiPolygon(shapes) { | |
var allRings = shapes.map(function (shape) { | |
// The shell of the polygon is in a separate property 'shell'. | |
var shell = remapLinearRing(shape['shell']); | |
// The 'holes' property is an array of linear rings for holes. | |
var holes = shape['holes'].map(h => remapLinearRing(h)); | |
// Combine the shell and holes so that the shell is the first element in the resulting array. | |
return [shell] + holes; | |
}); | |
// returns an object adhering to GeoJson Multipolygon specification. | |
return { | |
'type': 'MultiPolygon', | |
'coordinates': allRings | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment