Guest User

Untitled

a guest
Dec 19th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. from shapely.geometry import LineString
  2.  
  3. line1 = LineString([(0,0), (2,2)])
  4. line2 = LineString([(0,2), (2,0)])
  5. print(line1.intersection(line2))
  6.  
  7. POINT (1 1)
  8.  
  9. import fiona
  10. from shapely.geometry import LineString
  11.  
  12. sch = {}
  13. sch["properties"] = {}
  14. sch["geometry"] = "LineString"
  15. file = fiona.open("d:/tmp/test.gpkg", "w", driver="GPKG", schema=sch,)
  16.  
  17. line1 = LineString([(0,0), (2,2)])
  18. line2 = LineString([(0,2), (2,0)])
  19. print(line1.intersection(line2))
  20.  
  21. LINESTRING (2 2, 0 0)
  22.  
  23. Traceback (most recent call last):
  24. File "test2.py", line 11, in <module>
  25. print(line1.intersection(line2))
  26. File "C:OSGEO4~1appsPython37libsite-packagesshapelygeometrybase.py", line 620, in intersection
  27. return geom_factory(self.impl['intersection'](self, other))
  28. File "C:OSGEO4~1appsPython37libsite-packagesshapelytopology.py", line 65, in __call__
  29. self._validate(other, stop_prepared=True)
  30. File "C:OSGEO4~1appsPython37libsite-packagesshapelytopology.py", line 19, in _validate
  31. if stop_prepared and not hasattr(ob, 'type'):
  32. File "C:OSGEO4~1appsPython37libsite-packagesshapelygeometrybase.py", line 352, in type
  33. return self.geometryType()
  34. File "C:OSGEO4~1appsPython37libsite-packagesshapelygeometrybase.py", line 348, in geometryType
  35. return geometry_type_name(self._geom)
  36. File "C:OSGEO4~1appsPython37libsite-packagesshapelygeometrybase.py", line 70, in geometry_type_name
  37. return GEOMETRY_TYPES[lgeos.GEOSGeomTypeId(g)]
  38. OSError: exception: access violation reading 0x0000000000000000
Add Comment
Please, Sign In to add comment