CosmiQ / solaris

CosmiQ Works Geospatial Machine Learning Analysis Toolkit
https://solaris.readthedocs.io
Apache License 2.0
413 stars 112 forks source link

[MAINT] min_area filter in sol.vector.mask.mask_to_poly_geojson drops all polygons if crs is epsg:4326: would be nice to add crs check #397

Open wwymak opened 4 years ago

wwymak commented 4 years ago

Maintenance request summary

the sol.vector.mask.mask_to_poly_geojson currently has a default min_area of 40. While this is useful if you are only using the pixel version or you are using a reference image that has a crs with units in meters, if your reference image is in lat/lng, it drops all the polygons because it is unlikely any of them will span that many degrees of lat/lng. It would be nice to add a check for this and only use the min_area if the crs units are in meters/pixels, or at least give a user warning

Task detail and notes

probably add a check for the value of the crs before doing https://github.com/CosmiQ/solaris/blob/39611db0fde7877f69b819df618801136ba65691/solaris/vector/mask.py#L798

Any additional information:

AnshMittal1811 commented 3 years ago

Are you able to obtain vector files using epsg:4326 now? I have been trying to create vector masks for images with sol.vector.mask.mask_to_poly_geojson, but I only get the masks according to the pixel values. Is there a solution to getting masks according to lat/long in epsg:4326?