I have a series of LineString that I want to have the length in meters. I use the shapely.geometry module, and importing LineString.
I've seen this post, explaining how to do it, but it seems using Django : Get LineString length in meters (Python, GEODjango)
# Create a line string >>> line = LineString([(0, 0), (360, 0)]) # Specify srid using [WGS84] >>> line.srid = 4326 # Transform into projected coordinate system (using web mercator) >>> line.transform(3857) # Line length. This is zero within numerical precision, because the start # point (0, 0) is the same as the end point (0, 360)) on a map. >>> line.length >>> 1.1329847282581795e-08 # An example forcing the line through the other side of the world, # and specifying srid on definition. >>> line = LineString([(0, 0), (180, 0), (360, 0)], srid=4326) >>> line.tansform(3857) >>> line.length >>> 40075016.6855784
I try to use this post, but it makes me the following error :
'LineString' object has no attribute 'lenght'
IS there any module to import?