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

Styling geodata dynamically and media queries #209

Open
jrjdavidson opened this issue Nov 3, 2020 · 5 comments
Open

Styling geodata dynamically and media queries #209

jrjdavidson opened this issue Nov 3, 2020 · 5 comments

Comments

@jrjdavidson
Copy link

Hi
I was trying to think how I could dynamically change the styling of geodata. If the styling was html/css, I would probably create a class and add the class to the element when the style change was necessary. How would you go about it for geodata?

I also had a quick look in the docs for something similar to media queries in geodata styling but couldn't find anything. Any tricks that work like @media (hover: hover) { //style here..}.

@davidmtech
Copy link
Member

Hi,
there is good page with examples:

https://github.com/melowntech/vts-browser-js/wiki/Examples

Related examples are:

Geodata with dynamic render

This example is showing how to combine geodata with dynamically rendered features.

Geodata - Hover events

Example showing how to work with hover events.

Geodata - Click events

Example showing how to work with click events.

Geodata - Click and hover events

Example showing how to combine click and hover events.

Geodata - Advanced hover events

Example showing how to work with advanced hover events.

Documentation for geodata styles:
https://github.com/melowntech/vts-browser-js/wiki/VTS-Geodata-Format#geo-layer-styles-structure

I hope it helps.

@ghost
Copy link

ghost commented Nov 4, 2020

You can definitely change the style dynamically, for debug purpose, you can use the embedded inspector:

debug_styles

To access the style editor: Ctrl+Shift+D then Shift+E
More about the inspector: https://github.com/melowntech/vts-browser-js/wiki/VTS-Browser-Inspector-Mode

In addition to the davidmtech's links, I would add the following:

Hope that helps and don't hesitate to share with us your map :)

@jrjdavidson
Copy link
Author

Thanks for the example, that always help. However, the only type of interaction that allows you to modify geodata style in those examples are click and hover events, and even then only on the map.
However I was hoping to be able to modify geodata styles for other types of events that aren't necessarily map related (e.g. a click on a panel outside the map?). The only way I see of doing that now is by reloading the geodata with a new style definition, which seems to be a bit of a waste.

@gyenyame400
Copy link

2022, All the links are DEAD!

@jrjdavidson
Copy link
Author

Yes it's a shame. Last time I checked, it was just the melown cloud service that was not kept up. All the rest still works. If you replace the mapconfig.json link with an instance of your own vts backend, all the links should work fine.

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

3 participants