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

Wrong scheme? (TMS Shows nothing, XYZ works) #29

Closed
wslaghekke opened this issue Oct 11, 2019 · 7 comments
Closed

Wrong scheme? (TMS Shows nothing, XYZ works) #29

wslaghekke opened this issue Oct 11, 2019 · 7 comments
Assignees

Comments

@wslaghekke
Copy link

Im trying to use martin with some Dutch public data in EPSG 28992 but when adding it to the map i get no data.
After some troubleshouting i got it to work by changing the scheme in the tilejson from TMS to XYZ.
Am i doing something wrong, or could this actually be different, and if so, should this be configurable?

@stepankuzmin
Copy link
Collaborator

Hi @wslaghekke! Thanks for posting this. Could you please run martin in debug mode and post Postgres queries that martin produces here?

@wslaghekke
Copy link
Author

I cant easily share the query without revealing personal information (im testing with my home town), but ive run the url that mapbox-gl-js requests through tilebbox function from https://github.com/mapbox/postgis-vt-util/blob/master/src/TileBBox.sql.
When i used the tileJson as generated by martin (which is TMS) the resulting bounding box (converted to WGS84) is coordinates 6 and -52, but its supposed to be 6 and 52.
I'm not sure if maybe this is related to reprojection, as i dont have a great understanding of GIS, but when i changed the tileJson to xyz the resulting layer worked correctly.

Hope that is enough information, if its not, i can try to generate some more dat in other locations in the netherlands.

@stepankuzmin stepankuzmin self-assigned this Oct 14, 2019
@shaunakv1
Copy link

Hi @stepankuzmin

I can confirm this bug. Essentially by default (no configuration provided) the scheme that is coming out should be "scheme": "xyz" and its coming out to be "scheme": "tms"

You can check a live example here

https://codesandbox.io/s/hurricanes-tracks-using-mapbox-gl-with-geocoder-it3m3 (https://codesandbox.io/s/hurricanes-tracks-using-mapbox-gl-with-geocoder-it3m3)

Notice that source has tms scheme but it works fine when I override it in mapbox api as xyz

@robert-claypool
Copy link

robert-claypool commented Oct 24, 2019

I am also getting negative latitudes (y coordinate) when I need positive. Here's the generated SQL, reformatted but unchanged:

WITH bounds AS (
  SELECT
    ST_MakeEnvelope(
       -10390543.875527343
      ,-6212801.658154298
      ,-10380759.935908202
      ,-6222585.597773438
      ,3857
    ) as mercator,
    ST_MakeEnvelope(
       -10390543.875527343
      ,-6212801.658154298
      ,-10380759.935908202
      ,-6222585.597773438
      ,3857
    ) as original
)
SELECT
  ST_AsMVT(
     tile
    ,'public.switches'
    ,4096
    ,'geom'
  )
FROM (
  SELECT
    ST_AsMVTGeom(
      shape
     ,bounds.mercator
     ,4096
     ,64
     ,true
   ) AS geom
   ,"objectid"
   ,"description"
  FROM public.switches, bounds
  WHERE shape && bounds.original
)
AS tile
WHERE geom IS NOT NULL;

@stepankuzmin
Copy link
Collaborator

Thanks for posting this! I'll dig into it as soon as I have time.

@robert-claypool
Copy link

Thank you too!

It's a blocker for me, so if you know how to patch it but just don't have the time, let me know and I'll try to issue a PR.

@stepankuzmin
Copy link
Collaborator

Fixed in v0.5.0. TileJSON scheme is now xyz by default.

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

No branches or pull requests

4 participants