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

Unable to serve correct tiles with reprojection #282

Open
yarray opened this issue Feb 16, 2022 · 3 comments
Open

Unable to serve correct tiles with reprojection #282

yarray opened this issue Feb 16, 2022 · 3 comments
Labels

Comments

@yarray
Copy link

yarray commented Feb 16, 2022

I tried multiple sources including Natural Earth, UIA, etc., with both shapefile and postgis as datasources. However, although I could see some lines/polygons sometimes, it seemed that the tiles were always incorrect. To illustrate the problem, I created two datasets of polygons.

The first one contained several large polygons, like:

截屏2022-02-16 下午1 14 50

I then generated config with

./t_rex genconfig --datasource <path>/large_polygon.shp > config.test.toml

and then served the tileset with

RUST_LOG=debug ./t_rex serve -c config.dresden.toml

In the Xray tab:

截屏2022-02-16 下午1 28 10

The log printed "1 features" for some tiles. It also occasionally printed "ERROR 1: latitude or longitude exceeded limits". I'm not sure whether it's related to the final output.

截屏2022-02-16 下午2 39 10

The corresponding config was:

# t-rex configuration

[service.mvt]
viewer = true

[[datasource]]
path = "/Users/yarray/data/test/large_polygon.shp"
name = "datasource"
default = true

[grid]
predefined = "web_mercator"

[[tileset]]
name = "large_polygon"
extent = [65.11901, 15.94669, 129.20218, 60.21640]
[[tileset.layer]]
name = "large_polygon"
table_name = "large_polygon"
geometry_field = ""
geometry_type = "POLYGON"
srid = 4326
buffer_size = 1
#make_valid = true
simplify = true
query_limit = 1000
#[[tileset.layer.query]]

#[cache.file]
#base = "/tmp/mvtcache"
#baseurl = "http://example.com/tiles"

[webserver]
# Bind address. Use 0.0.0.0 to listen on all adresses.
bind = "127.0.0.1"
port = 6767

#[[webserver.static]]
#path = "/static"
#dir = "./public/"

The input shapefile was large_polygon.zip.

@pka pka added the question label Feb 16, 2022
@pka
Copy link
Member

pka commented Feb 16, 2022

Had a quick look at the data and seems to be a reprojection problem. When I reproject manually from EPSG:4326 (WGS 84) to EPSG:3857 (Web Mercator), the tiles look fine.

ogr2ogr -t_srs EPSG:3857 poly3857.shp ./large_polygon.shp

@yarray
Copy link
Author

yarray commented Feb 16, 2022

@pka Thanks for your help! I can confirm that supplying data with EPSG:3857 works. But is my config correct for 4326 data? It is still a bug I guess?

@yarray yarray changed the title Unable to serve correct tiles Unable to serve correct tiles with reprojection Feb 16, 2022
@pka
Copy link
Member

pka commented Feb 16, 2022

Your configuration looks correct and automatic reprojection should give the same result. Will look into it.

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