Closed aoyaZY closed 3 years ago
@aoyaZY , if you want to add them to the map, but not have them show straight away, you can set enabled = false
on the DataSource
.
Does that help?
@nzjony , thanks for your suggestion. let me be more specific , for example: I define two stylesets , road and building , road shows between 5-10 level, building shows between 10-15 level, they base on two different datasources. When the map between 10~15, road's datasource will send request too, though it doesn't show on map. If I set enabled = false on the DataSource, that means I have to control all my datasource at every level , that‘s troublesome for me . So I set minDisplayLevel and maxDisplayLevel on DataSource , that resolved the problem. But that would make others confuse with styleset's minZoomLevel and maxZoomLevel , because they all effect the layer. I have experienced mapboxJS , it would request data just before the layer really show , though the datasource has already been added . I'd be happy if your team have plan to optimize it . If you are too busy to handle it , never mind , I would close this issue : )
@aoyaZY , thanks for clarifying your use case. Yes, I see now that using enabled = false
, isn't going to work.
You mean do some preprocessing to the theme and check that if there is no technique for a given zoom level, then ignore all requests for tiles? Yes, that would be a valid optimization, I will ask the team, though yes, we are quite busy at the moment with some internal projects.
Apart from the confusion that minDisplayLevel
and maxDisplayLevel
provide, this otherwise is a valid work around, until some optimization is done correct?
I spoke to @robertoraggi , he said that because the style lets the user define a min/maxZoomLevel
as an expression based on the data, eg: “minZoomLevel: [“get”, "whatever"]
, it would not be possible, because we would have to first download the tile and execute the expression before we know whether the tile can be shown.
@nzjony , @robertoraggi , for defining a min/maxZoomLevel as an expression based on the data , maybe you can determine if min/maxZoomLevel is an expression , then decide if download the tile to execute the expression. Or the map have to download a lot of tiles , even though styleset has told it these tiles are not necessary to be shown at this level. Especially there are a lot of different datasources , that will slow down tile loading speed , isn't it?
@aoyaZY, why not use minDisplayLevel
and maxDisplayLevel
and ignore min/maxZoomLevel
in the theme? Yes, I take your point, we could do this, but it would complicate the internal logic, and if the styles were updated from simple numbers to expressions, then the reduction in performance may not be so clear.
Maybe if there is enough request from the OS community then we would consider it.
@nzjony yes , I resolved the problem by this way , just like I mentioned before . That's just a little suggestion, never mind , thanks for your patient : )
@aoyaZY , thanks also for the idea and I'm glad that this works for you for now. I look forward to see what you get up to with harp.gl, please keep us up to date if you can.
@aoyaZY , look at: https://github.com/heremaps/harp.gl/pull/1958
It is the optimization you mentioned above, i.e. that we don't process tiles that are outside the min/max zoom level specified in the style. We are still investigating it, hence it is a draft, but I wanted to mention it to you.
@nzjony , I am very to hear that , and good luck to you !
I add some vectorTile datasources to the map , but I just use some of these to show on map first , the rest is for later. But harp will request all of them at the same time , that will slow the data loading speed . Maybe harp can request data just when map use it to show.