Does library reproject EPSG 3857 into 4326 automatically #37
-
I am trying to download GeoPackage from OpenTopoMap, OpenStreetMap, GoogleMaps and other online sources to test it with NASA WorldWind viewer, but when I select EPSG 4326 projection for this sources your app always process 1 tile per 5 sec and then it finish downloading with error message that no tiles were downloaded. The same source URL with EPSG 3857 is downloading normally, but WorldWind does not support GeoPackage with this projection. Example URL https://a.tile.opentopomap.org/{z}/{x}/{y}.png Does application support automatic on the go reprojection of EPSG 3857 into 4326? If not, do you plan to implement it? |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 7 replies
-
Here is an example code to reproject downloaded tile if it was not implemented yet:
Here is also a MercatorSector if required:
|
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Thank you for quick answer. What do you mean "required overlapping pixels"? As I understand to reach the goal it is necessary only to make pixel by pixel transformation of each downloaded tile using the code example above and use different tile borders calculation in the viewer. I am using this approach now for online sources in WorldWind (download and reproject tile on the go) and it looks ok without any artifacts. I just search a possibility to make file cache and your library seems to be the best solution for this. Do you think it is not useful feature to be able to use any popular online map source like OSM, OTM, Google, Yandex, Wiki in equirectangular projection? |
Beta Was this translation helpful? Give feedback.
-
It is certainly possible to project a single EPSG 3857 tile to EPSG 4326. However, the projected tiles must be stored using the GeoPackage spec and tile storage requirements. The Tile Matrix Set defines the bounds (min x, min y, max x, max y) of the tiles in the projection. For all tiles at each zoom level, a Tile Matrix defines the matrix width, matrix height, tile width, tile height, pixel x size, and pixel y size. The pixel sizes must be constant throughout all tiles in the zoom level. As an example, imagine receiving a 2 x 2 grid of 256 x 256 web mercator tiles, totaling 4 tiles. The pixel calculations in meters come out to
These 4 tiles can each individually be projected to WGS84... The pixel calculations in degrees for the top two tiles:
The pixel calculations in degrees for the bottom two tiles:
A single pixel x and y size must be stored for each zoom level of tiles. Therefore, the WGS84 tiles must be projected and stored as (using "required overlapping pixels"): The pixel calculations in degrees:
Tiles can be stored in any projection. Our libraries and apps handle querying for tiles by XYZ, TMS, or bounding box in a desired projection. The underlying tiles are queried, drawn to a single tile, and reprojected as needed. The functionality we intend to add includes reprojecting any tile layer within the GeoPackage to a different projection (just not during on the fly downloading). Our libraries also handle more than just the EPSG 3857 and EPSG 4326 projections. All implementations are generic using a projection library.
Tiles from any source can currently be saved as a valid GeoPackage tile layer in their current projection. Viewers / clients should implement the GeoPackage spec and reproject tiles as they need them. Since you are using a viewer without this reprojection capability, you would be able to use the planned reprojection tile layer functionality to tune your GeoPackage. |
Beta Was this translation helpful? Give feedback.
-
Converted from an Issue to a Discussion |
Beta Was this translation helpful? Give feedback.
-
I have this functionality implemented in our iOS library and will port it to our Java/Android GeoPackage libraries next month. |
Beta Was this translation helpful? Give feedback.
I have this functionality implemented in our iOS library and will port it to our Java/Android GeoPackage libraries next month.