AlexeyPechnikov / pygmtsar

PyGMTSAR (Python InSAR): Powerful and Accessible Satellite Interferometry
http://insar.dev/
BSD 3-Clause "New" or "Revised" License
418 stars 91 forks source link

Sbas.export_geojson() problem #152

Open georgeboldeanu opened 1 month ago

georgeboldeanu commented 1 month ago

Hello, @AlexeyPechnikov ! I think that there is a problem with the sbas.export_geojson() function. The results from the function are a little bit odd, from a misalignment point of view. Exporting the same data as a raster with sbas.export_geotiff() and as a vector with sbas.export_geojson() provides 2 shifted outputs (See attachement). image

The raster is the original result exported sbas.export_geotiff(displacement_ps_mm2[9:10], 'cop_fin_exps/displacement_psmm2') and the vector is exported with sbas.export_geojson(displacement_ps_mm2[9:10],'cop_fin_exps/displacement_ps_mm2_vect_6iunie'). In QGIS i didnt understand why the points from GeoJson were that concentrated, like 2points per pixel. I converted the raster to vector and it seems that there are 2 extra vectors (6 polygons per 4 cells). The red values are the values from the PyGMTSAR and the yellow values are extracted from SAGA GIS, same behaviour, 6 values on 4 cells. The red geometry is the converted raster to vector using basic QGIS functions. What can cause such a behaviour?

AlexeyPechnikov commented 1 month ago

This is a QGIS issue with GeoTIFF files displaying: the shape of the files is distorted, so for example, a 5x5 pixel raster is shown as 4x6. You can resolve the problem by converting the GeoTIFF files to GeoNetCDF and opening them in QGIS without the issue:

gdal_translate disp.2015-03-10.tif disp.2015-03-10.nc

After that, you should see your GeoJSON points at the centers of the raster cells.

image
georgeboldeanu commented 1 month ago

Yes, after doing gdal_translate the computed points where corectly put on the centroid of the pixels. The problem is that the pixels remain the same. Why is that, is there an asumption or any logic behind it?

AlexeyPechnikov commented 1 month ago

What problem?

georgeboldeanu commented 1 month ago

They have the shape from S1 original data, aprox 4x15. They are still in range x azimuth? I export the raster with export_geotiff function. Also, from this there is a very high concentration of points..with some of them being duplicates, like 7.1 on the left side of the screenshot I provided. image

AlexeyPechnikov commented 1 month ago

The results are, of course, exported in geographic coordinates, not radar coordinates. The grid spacing is chosen to be approximately equal to the average radar grid spacing. Note that radar pixels projected onto topography have very different shapes and areas. It is possible to produce the exact shapes of radar pixels in geographic coordinates, although these shapes can be complex. I have shared screenshots on LinkedIn and provided examples in the PyGMTSAR video lectures.

Rather than filtering out neighboring pixels with the same results, PyGMTSAR takes the opposite approach by merging them to produce precise shapes for homogeneously displaced areas.

Screenshot 2024-07-20 at 13 46 44