Created
March 12, 2014 20:25
-
-
Save mpaolino/9515564 to your computer and use it in GitHub Desktop.
geographic polygon calculation
This file contains hidden or 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
from geographiclib.geodesic import Geodesic | |
from geographiclib.polygonarea import PolygonArea | |
# Polygon for roof at http://maps.googleapis.com/maps/api/staticmap?center=33.402285,-111.942715&zoom=20&size=300x300&maptype=satellite&sensor=false&path=color%3ared%7Cweight:1%7Cfillcolor%3awhite%7C33.4022475,-111.9426775%7C33.4022475,-111.9427525%7C33.4023225,-111.9427525%7C33.4023225,-111.9426775%7C33.4022475,-111.9426775 | |
roof_polygon = PolygonArea(Geodesic.WGS84) | |
roof_polygon.AddPoint(33.4022475, -111.9426775) | |
roof_polygon.AddPoint(33.4023225, -111.9426775) | |
roof_polygon.AddPoint(33.4023225, -111.9427525) | |
roof_polygon.AddPoint(33.4022475, -111.9427525) | |
roof_polygon.AddPoint(33.4022475, -111.9426775) | |
(number, perimeter, area) = roof_polygon.Compute(False, True) | |
# (number of polygon, perimeter in meters, area in meters^2) | |
print((number, perimeter, area)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment