Repast / repast.simphony

Git repository for Repast Simphony development
repast.github.io
90 stars 21 forks source link

GIS UTM raster misalginment #55

Open etatara opened 2 years ago

etatara commented 2 years ago

Loading UTM rasters are misaligned by about 20 meters in the GIS display. This may be due to geotools conversion accuracy. QGIS and WorldWind Java example will align the Geography demo UTM Chicago raster properly. Geotools does not appear to be converting coords properly. There may also be pixel width issues that we need to account for in the display.

After investigating this issue, it appears to be due to projection conversion accuracy in the default transforms that the geotools library is using. The GIS display is based on the WorldWind Java library that requires WGS 84 lat/lon coordinates internally, so the Repast GIS display class automatically converts projected coordinates as in UTM data to WGS 84, irrespective of the CRS that’s used by the Repast Geography. I tested a code-generated WritableGridCoverage2D using WGS84 and loaded a raster in WGS84, and both of them line up perfectly with specific coordinates and Bing imagery layer, so that confirms that the Repast display is aligning layers properly as long as everything is in WGS84. I did see the misalignment when loading UTM raster data, and the misalignment appears to be around 20 meters. This misalignment isn’t obvious until the display is zoomed in pretty far, which is probably why I didn’t catch it in earlier testing.

If I load the UTM raster into QGIS, it aligns perfectly with the ESRI WGS84 mage layer, so QGIS is handling the projection properly. But it’s also telling that QGIS provides a list of transforms for UTM raster through the add layer wizard which suggests that QGIS may have more accurate transforms compared with the default geotools. I’ll need to look into this a bit more and for now they only suggestion I can make is to use something like QGIS to reproject your data to WGS84 from UTM since it has more accurate transforms.