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

Vector shapefiles not rendered at same projection as raster #92

Open
howff opened this issue Nov 9, 2024 · 4 comments · May be fixed by #98
Open

Vector shapefiles not rendered at same projection as raster #92

howff opened this issue Nov 9, 2024 · 4 comments · May be fixed by #98

Comments

@howff
Copy link
Contributor

howff commented Nov 9, 2024

When I load a Vector file in .shp format and select the (only) named layer there is nothing rendered in the display, when I've got other GeoTIFFs loaded. It seems to display when it is loaded by itself but in a very poor map projection. When I load it on top of a GeoTIFF, as a coastline overlay, then it is not visible.

It seems that I have to manually reproject the shapefile into the same projection as the GeoTIFF, is this expected?

(I thought other software would handle this automatically)

@howff howff changed the title Vector shapefiles not rendered Vector shapefiles not rendered at same projection as raster Nov 9, 2024
@gillins
Copy link
Member

gillins commented Nov 10, 2024

Yes this is expected - currently must be in the same projection as the raster. Happy to receive a pull request to address this if you think this is necessary.

@gillins
Copy link
Member

gillins commented Nov 10, 2024

Having said that, one of the benefits of tuiview IMHO is that you see the data actually as it is and without any transformation. I like that any mismatch shows up when I view it and before it causes any problems for downstream processing... I never know what to trust in QGIS. Is there any downside to running ogr2ogr first? Anyway, appreciate any thoughts you have.

@howff
Copy link
Contributor Author

howff commented Nov 12, 2024

Thanks for the explanation. I can see the pros and cons of both approaches. In the case of vectors I think it might be more intuitive to plot the vector using the projection of the visible rasters, but that's only from my perspective of trying to overlay things like coastlines, rivers, POIs, on top of images.

The main problem with the current approach is that GeoJSON files don't have a projection, they are assumed to be lat lon WGS84 degrees, so they will never be plotted correctly. Transforming the coordinates in the GeoJSON manually to the raster's projection is possible but non-standard as the coordinates will be in metres in an undefined (as far as the geojson file is concerned) projection.

@gillins
Copy link
Member

gillins commented Nov 15, 2024

I see what you are saying, although amusingly I was given a geojson this week in EPSG:4269, so it does happen.

How do you feel about a test that when a vector is opened and the projection for that vector differs from that for the rasters (ie not SpatialReference.IsSame) the user is asked whether they want to reproject the vector to match? And if so, a reprojection happens to each feature as it is reading (in vectorrasterizer.c). This shouldn't be too hard, although I might not get to this for a while. If you like, make a start on a PR and I can add to it.

@gillins gillins linked a pull request Jan 3, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants