Git Product home page Git Product logo

Comments (14)

mike-000 avatar mike-000 commented on June 6, 2024 1

The parser is not using the orderedAxes property in the json, and defauiting to the Lat/Lon axisOrientation for EPSG:4326.

from openlayers.

mprins avatar mprins commented on June 6, 2024

I'd expect that matrix set request to return a json response, but (in the browser) if returns a HTML response, that might be unexpected

from openlayers.

ahocevar avatar ahocevar commented on June 6, 2024

Vector tiles do not support client side reprojection. If you want to consume an EPSG:4326 service, your map's view projection also needs to be EPSG:4326. Also note that you do not need to specify featureProjection and dataProjection on the MVT format.

from openlayers.

ahocevar avatar ahocevar commented on June 6, 2024

I'd expect that matrix set request to return a json response, but (in the browser) if returns a HTML response, that might be unexpected

If that's the case, then you won't get it to work with my suggestion above. That might be a problem of the service you're consuming.

from openlayers.

doublebyte1 avatar doublebyte1 commented on June 6, 2024

Vector tiles do not support client side reprojection. If you want to consume an EPSG:4326 service, your map's view projection also needs to be EPSG:4326. Also note that you do not need to specify featureProjection and dataProjection on the MVT format.

Thanks for the comment @ahocevar . My view is indeed in 4326, but that does not change anything. I am unable to show any 4326 vector tiles.

,
    view: new View({
        center: [0,0],
        zoom: 2,
        projection: 'EPSG:4326'
    })

vectortiles-crs84

from openlayers.

doublebyte1 avatar doublebyte1 commented on June 6, 2024

I'd expect that matrix set request to return a json response, but (in the browser) if returns a HTML response, that might be unexpected

If that's the case, then you won't get it to work with my suggestion above. That might be a problem of the service you're consuming.

@ahocevar the same service works without problems, with a WebMercatorQuad Tile matrix set

vectortiles-mercator

from openlayers.

mike-000 avatar mike-000 commented on June 6, 2024

I'd expect that matrix set request to return a json response, but (in the browser) if returns a HTML response, that might be unexpected

The url for a json response is https://maps.gnosis.earth/ogcapi/tileMatrixSets/WorldCRS84Quad?f=json

from openlayers.

doublebyte1 avatar doublebyte1 commented on June 6, 2024

I'd expect that matrix set request to return a json response, but (in the browser) if returns a HTML response, that might be unexpected

The url for a json response is https://maps.gnosis.earth/ogcapi/tileMatrixSets/WorldCRS84Quad?f=json

@mike-000 I would expect the client to get the right format, by using content negotiation. There should be no need to enforce it with the "f" parameter.

from openlayers.

mike-000 avatar mike-000 commented on June 6, 2024

I would expect the client to get the right format, by using content negotiation. There should be no need to enforce it with the "f" parameter.

Yes, it does return a json when the application sets a Accept: application/json header. The reason no tiles are loaded is the calculated tile grid has an incorrect extent [90, -360, 450, -180] https://codesandbox.io/s/ogc-vector-tiles-forked-pkzctf

from openlayers.

doublebyte1 avatar doublebyte1 commented on June 6, 2024

I would expect the client to get the right format, by using content negotiation. There should be no need to enforce it with the "f" parameter.

Yes, it does return a json when the application sets a Accept: application/json header. The reason no tiles are loaded is the calculated tile grid has an incorrect extent [90, -360, 450, -180] https://codesandbox.io/s/ogc-vector-tiles-forked-pkzctf

Unfortunately I cannot open your sandbox. Here is my code: https://github.com/ogcincubator/ogcapi-tiles-map/blob/master/main.js

from openlayers.

mike-000 avatar mike-000 commented on June 6, 2024

The codesandbox is based on https://openlayers.org/en/latest/examples/ogc-vector-tiles.html with the main.js changed to

const map = new Map({
  target: 'map',
  layers: [
    new VectorTileLayer({
      source: new OGCVectorTile({
        url:
          'https://maps.gnosis.earth/ogcapi/collections/NaturalEarth:cultural:ne_10m_admin_0_countries/tiles/WorldCRS84Quad',
        format: new MVT(),
        projection: 'EPSG:4326',
      }),
      background: '#d1d1d1',
      style: {
        'stroke-width': 0.6,
        'stroke-color': '#8c8b8b',
        'fill-color': '#f7f7e9',
      },
    }),
  ],
  view: new View({
    center: [0, 0],
    zoom: 1,
    projection: 'EPSG:4326',
  }),
});

setTimeout(() => {
  console.log(map.getLayers().item(0).getSource().getTileGrid().getExtent());
}, 5000);

from openlayers.

doublebyte1 avatar doublebyte1 commented on June 6, 2024

Thank you @mike-000! Indeed the grid with in 4326 does not look right:
[90, -360, 450, -180]
While the grid in 3857 looks like this:
[-20037508.342789244, -20037508.342789244, 20037508.342789244, 20037508.342789244]

I assume the problem is in this file?
https://github.com/openlayers/openlayers/blob/main/src/ol/tilegrid/TileGrid.js

from openlayers.

mike-000 avatar mike-000 commented on June 6, 2024

It will be an incorrect extent passed to that constructor at https://github.com/openlayers/openlayers/blob/main/src/ol/source/ogcTileUtil.js#L293

from openlayers.

mike-000 avatar mike-000 commented on June 6, 2024

#15524 fixes the axis order when a projection is specified in the constructor, but there is a separate issue that specifying the projection should not be necessary, the crs in the TileMatrixSet could be used but isn't.

from openlayers.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.