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

more options for vector tile sources #177

Merged
merged 2 commits into from
Aug 28, 2023

Conversation

mschilde
Copy link
Contributor

@mschilde mschilde commented Aug 21, 2023

Sorry for the issue-less PR.

This PR extends the RLayers support for options supported by the OL SourceVectorTile constructor. I.e. you can now specify a lot more options when using RLayerVectorTile.

My original motivation was that OL vector tile layers don't really support overzooming.

E.g. if a vector tile source only supports tiles up to zoom level 15 the only way to allow zooming past that level is to provide a custom loader function. There's also an OL example which is referenced in a lot of the overzooming Github issues.

Passing this loader function to the OL tile source is not possible at the moment.

I also added the other options supported by the source, e.g. tileGrid, tileSize etc.

Open points up for debate:

  • I moved some of the options directly to the base props in RLayerProps (wrapX, cacheSize), they seem to be supported by most sources. We had this discussion before :-) If you're ok with it I can propagate the more common options to the supported sources.

  • I saw there's an intermediate interface RLayerBaseVectorProps which supports some of the missing options. But extending this interface instead of RLayerProps gives a few errors which I didn't dare to fix. I can give it a shot if you'd rather have the vector specific props there.

@codecov-commenter
Copy link

Codecov Report

Patch and project coverage have no change.

Comparison is base (d98cf45) 98.43% compared to head (9ce070e) 98.43%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #177   +/-   ##
=======================================
  Coverage   98.43%   98.43%           
=======================================
  Files          74       74           
  Lines        1532     1532           
  Branches      253      253           
=======================================
  Hits         1508     1508           
  Misses         24       24           
Files Changed Coverage Δ
src/layer/RLayer.tsx 100.00% <ø> (ø)
src/layer/RLayerVectorTile.tsx 100.00% <ø> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mmomtchev
Copy link
Owner

You realize that these option will be fixed? Ie, if your component is updated, they won't be refreshed.

@mschilde
Copy link
Contributor Author

I'd need a bit more feedback, I'm not super familiar with the rlayers codebase. Are you talking about the refresh function?

@mmomtchev
Copy link
Owner

Yes, the refresh function is called when React updates a component - but in fact OpenLayers does not support modifying any of those properties once the layer is created. RLayerTileWMS has the same problem and it works around ot by deleting the underlying layer and creating a new one.

@mmomtchev mmomtchev merged commit ffea94c into mmomtchev:main Aug 28, 2023
23 checks passed
@mschilde mschilde deleted the feature/more-options branch August 28, 2023 09:48
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

Successfully merging this pull request may close these issues.

3 participants