Created
May 24, 2022 20:53
-
-
Save jleedev/c36fcbe5a36fab15969c8782884d2af2 to your computer and use it in GitHub Desktop.
extremely normal shell script
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 ubuntu | |
RUN apt-get update | |
RUN apt-get -y install gdal-bin | |
RUN apt-get -y install jq | |
RUN >x.csv printf 'id,WKT\n1,%s\n' "$(echo '[[0.2,0.2],[0.75,0.75],[0.25,0.75],[0.2,0.2]]' \ | |
| jq '(2*(-1|acos)*6378137)as$c|[.[]|[(.[0]-0.5)*$c,(0.5-.[1])*$c]|join(" ")]|join(",")|"LINESTRING("+.+")"')"; \ | |
echo EPSG:3857 >x.prj | |
RUN ogrinfo --version | |
RUN ogr2ogr -t_srs WGS84 -f GeoJSONSeq y.geojsons x.csv -dialect sqlite -sql 'select ST_Length(geometry) from x' | |
RUN <y.geojsons jq '(2*(-1|acos)*6378137)as$c|.properties."ST_Length(geometry)"/$c' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment