Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Add vector layer with itself style url after load map with main style #14644

Closed
AliKhoshraftar opened this issue May 13, 2019 · 3 comments
Closed

Comments

@AliKhoshraftar
Copy link

Hi
We are using mapbox on android. we have our own style and everything is ok except that adding a vector source with it's specific style out of main loaded style.
It means that after map loaded with our main style , we need to add a vector layer with it's source and style over the main style dynamically ( i.e by clicking a button ).
We didn't find any helpful feature in documentation and in search results.

Steps to reproduce

  1. Load Main Style
  2. Add Vector Layer with its source and style with separate endpoints

Expected behavior

We expect that mapbox style should have a feature that we can add vector source with it's own style that is separate than main loaded style. both vector source and it's style with different endpoint url.
We are using like this :

loadedStyle.addSource(VectorSource("metro", "https://ourwebsite:metro@EPSG:900913@pbf/{z}/{x}/{y}.pbf"))

but it needs an style to show this source that we should write it's expression by hard code it.
for example in future when we want change it's layer color we should update app to change the expression , but if it support to load it's style from url we can change it's style whenever we want.

Actual behavior

Configuration

**Android versions: 8.0.0
**Device models: xiaomi mi mix
**Mapbox SDK versions: 7.3.2 ( latest till this post )

@tobrun
Copy link
Member

tobrun commented May 14, 2019

@AliKhoshraftar

We expect that mapbox style should have a feature that we can add vector source with it's own style that is separate than main loaded style. both vector source and it's style with different endpoint url.

I believe that you have a bit of misconception what a style is. A style object is a combination of Sources (the data) and Layers (the visual representation). As you already noticed, you can add a VectorSource and you are also able to add layers at runtime using Style#addLayer.

@tobrun tobrun closed this as completed May 14, 2019
@AliKhoshraftar
Copy link
Author

Hey , thank you for your response.
The problem is i can't addLayer with url, we need add vector source with its layer from url not build it in app.

@tobrun
Copy link
Member

tobrun commented May 15, 2019

Layers can't be loaded form a url, the closest thing relevant to this would be to add a layer based on json data as requested in #13467

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants