Re: [gdal-dev] Ellipsoidal length of a line

2019-06-16 Thread a . furieri
On Mon, 17 Jun 2019 09:46:20 +1200, Mike Taves wrote: I'm not sure how SpatiaLite has implemented ST_Length, but could be worth checking into. Hi Mike, SpatiaLite started supporting geodesic distances about ten years ago, and two different methods were implemented as internal C functions: 1.

Re: [gdal-dev] Ellipsoidal length of a line

2019-06-16 Thread Mike Taves
On Sat, 15 Jun 2019 at 03:32, Nicolas Cadieux wrote: > I am trying to get the length of a line in python. (Not just the straight > length between the first and last nodes). Using geopandas, (therefore the > Shapely lib) I am getting the euclidien distance even though the dataframe > holdings t

Re: [gdal-dev] Ellipsoidal length of a line

2019-06-15 Thread Thomas Knudsen
Awesome! Den lør. 15. jun. 2019 kl. 23.04 skrev Even Rouault < even.roua...@spatialys.com>: > $ cat test.csv > id,WKT > 1,"LINESTRING(2 49,3 50,4 49)" > > $ ogr2ogr test.db test.csv -f sqlite -dsco spatialite=yes -a_srs EPSG:4326 > > $ ogrinfo test.db -sql "select st_length(geometry, 1) from test

Re: [gdal-dev] Ellipsoidal length of a line

2019-06-15 Thread Even Rouault
$ cat test.csv id,WKT 1,"LINESTRING(2 49,3 50,4 49)" $ ogr2ogr test.db test.csv -f sqlite -dsco spatialite=yes -a_srs EPSG:4326 $ ogrinfo test.db -sql "select st_length(geometry, 1) from test" -al -q Layer name: SELECT OGRFeature(SELECT):0 st_length(geometry, 1) (Real) = 265450.955822012 Cf

Re: [gdal-dev] Ellipsoidal length of a line

2019-06-15 Thread Nicolas Cadieux
Thanks every one for your help, I found good packages out there. I will probably go with Proj. I’am just surprised it’s not part standard libraries like Shapely or OGR since both can calculate line length. Most packages look like they are made to calculate only two point at a time and not, fo

Re: [gdal-dev] Ellipsoidal length of a line

2019-06-15 Thread Thomas Knudsen
In the PROJ package, the geod utility is included - you could do echo lat0 lon0 lat1 lon1 | geod -I +ellps=GRS80 Where the "-I" indicates that you want to calculate the "inverse geodetic problem", i.e. you know where you are, and where you want to go, but you need to know how far to go and in wh

Re: [gdal-dev] Ellipsoidal length of a line

2019-06-15 Thread Andrew Bell
How is the line defined? If you have a function, there's calculus. On Sat, Jun 15, 2019, 12:43 AM Nicolas Cadieux wrote: > Thanks, > Could work but I think this will be too slow. I wonder how QGIS does it? I > guess they use code from Proj.4. If anyone has an other idea, shoot! > Cheers > Nicol

Re: [gdal-dev] Ellipsoidal length of a line

2019-06-14 Thread Nicolas Cadieux
Thanks, Could work but I think this will be too slow. I wonder how QGIS does it? I guess they use code from Proj.4. If anyone has an other idea, shoot! Cheers Nicolas > Le 14 juin 2019 à 13:20, Patrick Young a > écrit : > > Not exactly what you want, but you can do this with PostGIS by cast

Re: [gdal-dev] Ellipsoidal length of a line

2019-06-14 Thread Nicolas Cadieux
Thanks, The link brings me to some helpful packages. I thought gdal could be helpful as is has a very good OGR library that deals with this stuff. Nicolas > Le 14 juin 2019 à 12:19, Atle Frenvik Sveen a écrit : > > Hi! > > Not sure if would want to use gdal for this task*, but take a loo

Re: [gdal-dev] Ellipsoidal length of a line

2019-06-14 Thread Patrick Young
Not exactly what you want, but you can do this with PostGIS by casting your geometry to the geography type: https://postgis.net/workshops/postgis-intro/geography.html On Fri, Jun 14, 2019 at 10:26 AM Atle Frenvik Sveen wrote: > Hi! > > Not sure if would want to use gdal for this task*, but take

Re: [gdal-dev] Ellipsoidal length of a line

2019-06-14 Thread Atle Frenvik Sveen
Hi! Not sure if would want to use gdal for this task*, but take a look at this blog post: https://janakiev.com/blog/gps-points-distance-python/ *or if it's doable, i guess not, since the scope of gdal is reading/writing geospatial formats -a - Atle Frenvik Sveen a...@frenviksveen.net

[gdal-dev] Ellipsoidal length of a line

2019-06-14 Thread Nicolas Cadieux
Hi, I am trying to get the length of a line in python. (Not just the straight length between the first and last nodes). Using geopandas, (therefore the Shapely lib) I am getting the euclidien distance even though the dataframe holdings the line geometries has a CRS (WGS84, zone UTM 18 S). Obv