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

geotiff wrapX does not work under 4326 #15719

Open
heian911 opened this issue Apr 10, 2024 · 8 comments
Open

geotiff wrapX does not work under 4326 #15719

heian911 opened this issue Apr 10, 2024 · 8 comments
Labels

Comments

@heian911
Copy link

I loaded a geotiff file and set wrapX to true. If the map projection is 3857, there is no problem and it can be displayed repeatedly. However, if it is set to 4326, it will not work. Cannot be displayed repeatedly
image

@heian911 heian911 added the bug label Apr 10, 2024
@heian911 heian911 changed the title geotiff wrapX在4326下不能工作 geotiff wrapX does not work under 4326 Apr 10, 2024
@mike-000
Copy link
Contributor

mike-000 commented Apr 10, 2024

wrapX currently has a non-standard meaning Render tiles beyond the tile grid extent for GeoTIFF. This does not affect reprojected tiles (as it is considered when creating them, see #15484). As a workaround you can set a view projection based on, but not defined as equivalent to, the source projection which will force a reprojection

e.g. to wrap the example https://openlayers.org/en/latest/examples/cog-stretch.html use

  view: new View({
    projection: new Projection({
      code: 'EPSG:4326A',
      units: 'degrees',
      global: true,
      extent: [-180, -90, 180, 90],
    }),
    center: [0, 0],
    zoom: 2,
    maxZoom: 6,
  }),

@heian911
Copy link
Author

heian911 commented Apr 10, 2024

I want the map to be visible as well, the layers to be visible, and wrapX to be available, under 4326

@heian911
Copy link
Author

wrapX currently has a non-standard meaning Render tiles beyond the tile grid extent for GeoTIFF. This does not affect reprojected tiles (as it is considered when creating them, see #15484). As a workaround you can set a view projection based on, but not defined as equivalent to, the source projection which will force a reprojection

e.g. to wrap the example https://openlayers.org/en/latest/examples/cog-stretch.html use

  view: new View({
    projection: new Projection({
      code: 'EPSG:4326A',
      units: 'degrees',
      global: true,
      extent: [-180, -90, 180, 90],
    }),
    center: [0, 0],
    zoom: 2,
    maxZoom: 6,
  }),

But there is a problem. If the projection is set to 4326A, the map base map will not be displayed. I hope the map will also be visible.

@heian911 heian911 reopened this Apr 11, 2024
@mike-000
Copy link
Contributor

mike-000 commented Apr 11, 2024

But there is a problem. If the projection is set to 4326A, the map base map will not be displayed. I hope the map will also be visible.

If changing the view projection causes problems with other layers you could set 4326A as the projection in the GeoTIFF options instead https://codesandbox.io/s/cog-stretch-forked-jg2vf9

@heian911
Copy link
Author

但有一个问题。如果投影设置为4326A,则不会显示地图底图。我希望地图也能被看到。

如果更改视图投影会导致其他图层出现问题,您可以在 GeoTIFF 选项中将 4326A 设置为投影https://codesandbox.io/s/cog-stretch-forked-jg2vf9

What exactly is 4326A? Is there any documentation I can check? If it is a coordinate system, are there corresponding parameters?

@mike-000
Copy link
Contributor

There is nothing special about it. All projections must have a unique code and if no transforms are defined an identity transform will be used for the reprojection.

@heian911
Copy link
Author

image
Another problem I have is that there is a jagged edge problem after projection.

@mike-000
Copy link
Contributor

Another problem I have is that there is a jagged edge problem after projection.

This should be a separate issue. It happens with some reprojections where the edges can be clipped when using the canvas renderer, as in https://gis.stackexchange.com/a/364509/102658 and https://gis.stackexchange.com/a/432538/102658

I do not know if direct clipping would be possible with WebGL. Instead you could try adding an opaque canvas layer over the WebGL layer and clip that to create a spy hole, or you could use the WebGL layer as the source for an ol/source/Raster canvas layer which can be clipped directly as in https://jsfiddle.net/L0p1qh53/

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

No branches or pull requests

2 participants