Last active
August 29, 2015 14:25
-
-
Save kevinhughes27/b80c387faf6ea38ea144 to your computer and use it in GitHub Desktop.
scrape the actual polygon points from zuluru field drawings
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
// run by pasting the function into dev console then call it | |
// can also use something like Custom JavaScript for websites: | |
// https://chrome.google.com/webstore/detail/custom-javascript-for-web/poakhlngfciodnhlhhgnaaelnpjljija | |
// name and field are set by Zuluru | |
function scrape() { | |
data = "" | |
fields.forEach(function(field){ | |
// name | |
data += (name + field.num + " ") | |
// lat long | |
data += field.latitude + " " + field.longitude | |
// poly | |
vertices = field.field_outline.getPath(); | |
for (var i =0; i < vertices.getLength(); i++) { | |
var xy = vertices.getAt(i); | |
data += "p" + i + " (" + xy.lat() + " " + xy.lng() + ') '; | |
} | |
data += "\n"; | |
}); | |
console.log(data); | |
} | |
// just lat and long | |
function scrape() { | |
data = "" | |
fields.forEach(function(field){ | |
data += (name + field.num + " ") | |
data += field.latitude + " " + field.longitude | |
data += "\n"; | |
}); | |
console.log(data); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment