Adjusting height of Mapbox fill-extrusion in React js - mapbox

Good day!
I have a Mapbox map with an extruded polygon layer. I receive the data from a database and then display the geoJSON output using an extruded polygon. What I want to do is to increase the height of the polygon in the front-end, without having to change the data in the geoJSON.
So basically I want to do something like this:
"fill-extrusion-height": ["get", "hh_density_2042"] * 20
If that makes sense. I just want to use the values from the geoJSON, but I want to increase the height on the map. How do I do this?
PS. I have tried interpolation, but I don't want to bin the data.
All assistance is greatly appreciated, thanks!

You're on the right track, you just need to express the multiplication with a Mapbox GL expression:
"fill-extrusion-height": ["*", ["get", "hh_density_2042"], 20]

Related

How to make raster tiles in Albers projection or Equidistant Conic?

It`s necessary to make tiles in the non-mercator projection to display them in Leaflet using the Proj4Leaflet library.
How can i do this?
I tried to do it in Qgis, but the result was negative.

Mapbox Filtering Multipe Tile Layers at Once

Is it possible to set a filter for multiple tile layers at once? I currently have data stored in vector tile and the filters I am applying are near instantaneous - which is awesome!
That said, I would like to filter two different geometry types (line and circle) at once on the map. Each line will be tied to a circle.
Is this possible to do easily? It would be great if anyone knows of an example.
Thanks!!
Using mapbox-gl-js, it's as simple as:
for (const each layer of ['layer1', 'layer2']) {
map.setFilter(layer, myNewFilter)
}
Or with mapbox-gl-utils:
map.U.setFilter(['layer1', 'layer2'], myNewFilter);

Mapbox geometries get degraded when exported to tilesets

I'm trying out Mapbox for the first time, and playing around with drawing some polygons in the dataset editor for export to a tileset. However, the polygons in the resulting tileset are not the same as what I create in the editor. The polygons are only very rough, simplified approximations of the originals.
In dataset editor:
In map layer as tileset export:
I understand that Mapbox does vector simplification at certain zoom levels, but these changes are not zoom-dependent. I zoom in all the way and the shapes are still like this.
Moreover, such extreme degredation of the geometries makes tilesets essentially useless for features that require any sort of accuracy, like property lot lines.
Am I missing something, or is this really the expected behavior? Is there really no way to get accurate geometries into a tileset?
UPDATE: It appears this is only happening with shapes I create by drawing in the Mapbox data editor. So far the geometries that I've uploaded as geojson files have gotten converted to tilesets accurately...
I suspect this is because the maxzoom is too low.
When you create a Mapbox Tileset, either by uploading GeoJSON directly as a new Tileset, or by exporting your your Dataset to a Tileset, Mapbox will try to guess an appropriate minzoom and maxzoom of the Tileset.
Sometimes the min/max zoom's used aren't suitable for the map you're trying to create. Since there is no way to specify a maxzoom in either of the two approaches the only alternative is to create your Tileset locally with https://github.com/mapbox/tippecanoe specifying an appropriate maxzoom for your data and then uploading the resulting .mbtiles as a Mapbox Tileset.

Mapbox - extruding lines

Is it possible to apply fill-extrusion for a GeoJSON LineString feature?
Basically I'm looking for a way to draw lines (can be 1 line or multiple connected) in a 3d mode with z-offset.
If that's not possible, maybe this can be done with a polygon instead?
Like, converting my lines to polygons (how can i do that?)
What you're asking for isn't yet implemented, but ticketed in Mapbox GL JS at https://github.com/mapbox/mapbox-gl-js/issues/3993.
For now you'll need to opt for your second suggestion of converting the LineString feature to a Polygon. You can do this with turf's buffer function http://turfjs.org/docs#buffer.
The whole line/polygon will be offset at the same height, so depending on your application you could use turf's linkChunk http://turfjs.org/docs#lineChunk to get it broken up into smaller features which you assign different height properties to.

Vector layers with mapboxgl with no coordinates

Is there a way to draw a vector layer with CorelDraw for example and place it on napboxgl and use it as geojson layers?
For example https://seatgeek.com/colorado-rapids-at-seattle-sounders-fc-tickets/mls/2017-10-22-1-pm/3700786
Are they using geojson or etc.? Or just some sort of vector format?
I can't use geojson as it is hard to draw with QGIS any straight lines or symmetrical objects. I just want to draw a lot of vector objects and use them as layers with mapboxGL(use mapbox as render method and interact with layers as with geojson)
Any suggestions how to do it? Or is there a way to draw with Corel and then place it on map with QGIS?
Thanks
UPD:
Now I am using Corel -> dxf export and then import it to QGIS, then save it as geojson. But have some glitches with displaying that geojson geometry in mapbox, so I have to draw another in QGIS over the imported(dxf) one.
Here is an example of the bug, should be just a green polygon like the gray one
UPDATE: my fault, I was using lines instead of polygons.
I think you can achieve this as follows:
Convert the Corel output to SVG
Create an HTML element containing the SVG (not necessarily added to DOM)
On your Mapbox map, add a Canvas source containing the canvas: see https://www.mapbox.com/mapbox-gl-js/api/#canvassource
Obviously you will need to determine the lat/lon of the corners of your image somehow.