Wednesday 6 April 2016

python - Shapely LineString and Polygon intersect?


here is my python code, it does not intersect and when I plot this in google map , I see the intersection. shapely.geometry is in Cartesian plane, how you are solving this?


l = "40.65:-114.07 40.21:-112.96 40:-112.66 39.4:-112.7 39.39:-113.28 39.68:-113.94 40.42:-114.26 40.6:-114.22"
points = [[float(x) for x in c.split(":")] for c in l.split(" ")]

print(points)
polygon = Polygon(points)
path = LineString([(42.049999,-96.25), (38.0880979565,-119.609216457)])
if path.intersects(polygon):
print("intersect")

here is the intersection on google map


here is my code for google map:


https://gist.github.com/anonymous/8393151




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...