isciences / exactextract

Fast and accurate raster zonal statistics
Apache License 2.0
255 stars 33 forks source link

Emit error or automatically reproject on CRS mismatch #14

Closed yash-jain16 closed 4 years ago

yash-jain16 commented 4 years ago

Running in mac terminal after running docker exactextract -r lat:sample.tif[1] -p Block-polygon.shp -f District -s mean(lat) -o minimum.csv

bash: syntax error near unexpected token `('

Running in Docker container cli

exactextract -r lat:sample.tif -p Block-polygon.shp -f District -s mean(lat) -o minimum.csv

/bin/sh: 1: Syntax error: "(" unexpected

dbaston commented 4 years ago

Wrap your arguments in quotes: exactextract -r "lat:sample.tif[1]" -p Block-polygon.shp -f District -s "mean(lat)" -o minimum.csv

yash-jain16 commented 4 years ago

Thanks for this, but the retrieved CSV file has no value in it. It gives the following output: image

yash-jain16 commented 4 years ago

docker run --rm -it exact:tag -r "lat:/path_to_file/sample.tif[1]" -p /path_to_file/Block-polygon.shp -f District -s "min(lat)" -o /path_to_file/minimum.csv

ERROR 4: /path_to_file/sample.tif: No such file or directory Error: Failed to open /path_to_file/sample.tif

Error when executing through ENTRYPOINT

dbaston commented 4 years ago

You need to expose your inputs to Docker; add -v /path_to_file:/path_to_file to your docker run command.

yash-jain16 commented 4 years ago

Thanks for all your help, actually I was able to run the code but the output csv file has no value in it. It does create the columns but there are no values for any of the operations(mean,min,etc...) image Could you please guide me as to where I would be going wrong.

dbaston commented 4 years ago

Can you share the inputs?

yash-jain16 commented 4 years ago

Archive.zip The zip contains the input file as sample.tif(a sentinel 2 image) and the shapefile in .shp format. -r "lat:sample.tif[1]" -p Block-polygon.shp -f District -s "min(lat)" -o minimum.csv These were the parameters passed.

dbaston commented 4 years ago

The results are empty because exactextract assumes that all of its inputs are in the same coordinate system (and these are not). Ideally it would detect this and emit an error (or reproject itself) but it doesn't currently.

yash-jain16 commented 4 years ago

Thank you soo much! Works like a charm.