Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get wrong crs from tif file with coordinates ESRI:54009 #3489

Open
imperio-wxm opened this issue Nov 30, 2022 · 3 comments
Open

Get wrong crs from tif file with coordinates ESRI:54009 #3489

imperio-wxm opened this issue Nov 30, 2022 · 3 comments

Comments

@imperio-wxm
Copy link

imperio-wxm commented Nov 30, 2022

Describe the bug

Crs info error when reading a tiff file with coordinates ESRI:54009

To Reproduce

image

cog.tiff.zip

 val path = "./cog.tiff"

val sourceRDD: RDD[RasterSource] = sc.parallelize(Seq(path)).map(uri => {
     GeoTiffRasterSource(uri): RasterSource
})

println(s"CRS = ${sourceRDD.first().crs}")

CRS = LatLng

When I debugged the TiffTags class, I found that there was a problem with the acquisition of crs, and the default LatLng coordinate system was used.

image

Environment

  • Java version: 1.8.0_151

  • Scala version: 3.2.1

  • GeoTrellis: 3.6.2

@pomadchin
Copy link
Member

pomadchin commented Nov 30, 2022

Hey @imperio-wxm, GT does not support ESRI projections, so it is not a bug; we default back to LatLng in this case, similar to GDAL.

cs.Tags.model contains 6.3.1.1 Model Type Codes.

6.3.1.1 Model Type Codes

Ranges:
   0              = undefined
   [   1,  32766] = GeoTIFF Reserved Codes
   32767          = user-defined
   [32768, 65535] = Private User Implementations
GeoTIFF defined CS Model Type Codes:
   ModelTypeProjected   = 1   /* Projection Coordinate System         */
   ModelTypeGeographic  = 2   /* Geographic latitude-longitude System */
   ModelTypeGeocentric  = 3   /* Geocentric (X,Y,Z) Coordinate System */

As you can can see, this code https://github.com/locationtech/geotrellis/blob/master/raster/src/main/scala/geotrellis/raster/io/geotiff/tags/TiffTags.scala#L339-L364 handles support of ModelTypeProjected and ModelTypeGeographic models only. 32767 matches to the user-defined model which is not handled at the moment (handled as None).

@imperio-wxm
Copy link
Author

@pomadchin
Hi, why doesn't it throw an unsupported exception?
The default LatLng will cause crs and extent to not be in the same system, no errors will be reported during the calculation process, and it is difficult to find problems.

@pomadchin
Copy link
Member

pomadchin commented Dec 2, 2022

Well no error is because very often it happens so that the dataset contains invalid or a partially valid GIS data (it is pretty much imperfect and contains a lot of legacy usually).

Another argument is to align with the GDAL behavior.

I would agree though, at least some extra logging could help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants