Created
August 14, 2012 18:34
-
-
Save wboykinm/3351529 to your computer and use it in GitHub Desktop.
hood2json
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 hoodToJson( hood ) { | |
var polygon = polygons[hood]; | |
var array = polygon.getPath().getArray(); | |
var coords = []; | |
for ( var i=0; i<array.length; i++ ){ | |
coords.push( [ array[i].lng(), array[i].lat() ] ); | |
} | |
return JSON2.stringify( { type: "Feature", geometry: { type: "Polygon", coordinates: [ coords ] }, properties: { name: hoods[hood].name } } ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment