lolochristen / OpenLayers.Blazor

An Map component for Blazor based on OpenLayers with support for swisstopo swiss maps.
MIT License
37 stars 13 forks source link

Possible error displaying MVT source #62

Closed bouskdav closed 2 months ago

bouskdav commented 2 months ago

Hi!

I found possible error in displaying data from mapbox vector tiles. I took your demo (page Open Street Map) and put a new layer there defined as:

<Layer SourceType="SourceType.XYZ" CrossOrigin="anonymous" Url="https://tiles.mapillary.com/maps/vtp/mly1_public/2/{z}/{x}/{y}?access_token=MLY|4142433049200173|72206abe5035850d6743b23a49c41333"> </Layer>

now the server responds correctly with 200 but nothing is displayed. I tried both server and wasm render modes and I believe, that CORS is not the problem.

BTW: thanks for this owesome wrapper :)

Cheers, David

bouskdav commented 2 months ago

OK, found the issue in interop js file. Please find correction below:

case "VectorMVT": l.source.format = new ol.format.MVT(l.source.formatOptions); source = new ol.source.VectorTile(l.source); break;

and then

if (source instanceof ol.source.Vector) ollayers.push(new ol.layer.Vector(l)); else if (source instanceof ol.source.VectorTile) ollayers.push(new ol.layer.VectorTile(l));

Thanks and regards! David

lolochristen commented 2 months ago

Thanks for your input. I have reproduced the issue and am working on properly implementing vector layers in branch feature/vector_layers_finalization. The current implementation was just half cooked.

lolochristen commented 2 months ago

The latest release 2.0 has full and proper support of vector layer including MVT sources.