We are trying to create a polygon programmatically in typescript using mapbox gl. But starting height and ending height of the polygon will be different to create a slope. Please let me know is there any way to achieve this requirement.
Mapbox GL JS does not support 3D shapes with sloping surfaces. You could use something like three.js (via ThreeBox) to achieve it.
Related
I'm working website which uses a lot of markers. And for performance reasons I'm going to render only visible markers after each move.
I'm using mapbox js library via react-mapbox-gl react library.
Any advice how to get visible coordinates from map? Top left and bottom right visible coordinates is enough.
You can use map.getBounds() or map.getBounds().toArray().
So my problem is, that I have a tileset which geometries are Multipolygons and when I want to display the district names it places multiple labels instead of just one centered. Is there a way to fix this?
Here is a screenshot for clarification
The data comes from a postgis database, I just export it to a CSV and upload it to mapbox.
I have tried converting the Multipolygon into single Polygons but that ended in the same result.
I also played around with the text padding in mapbox studio but with this option the label placement is very off.
Is there possibly a way trough Mapbox GL JS to fix this issue?
You need to generate a separate label layer. You can use geojson-polygon-labels to do this.
How can I add a 3 dimensional sphere to Mapbox GL using the Javascript API? I've read about the fill-extrusion property but I'm unsure how I would use it for a sphere. I'm trying to create a semi-transparent dome around a latitude/longitude coordinate based on a distance radius.
There's no way to do anything like that at present. The only 3D features are fill-extrusions, which have flat tops. Maybe you could create an image that looked like a 3D dome, and overlay that.
In mapbox studio I have a lot of layers for customizations. Is there a way to access those layers programmatically with js. For example hide all WATER or ROAD layer on the map with js?
Thanks.
You can try using https://github.com/mapbox/vt2geojson to get geojson data for whichever layers you are interested in and then use this data and add styling using mapbox gl js maps.
Hope that answers your question.
I'm using Leaflet and MapBox. I need to develop an api which will show certain city points with labels, and accordingly draw routes between them. I have BlueMarble tiles till certain zoom, and then MapBox Streets. What is the best way to realize that idea? Are circles and paths the best option? Thank you.
I am not sure that you need to create an API for what you want to do.
http://leaflet.cloudmade.com/examples/geojson.html
In the Leaflet tutorials it shows you how to create LineStrings and Points from GeoJson data. So with latitude and longitude coordinates for the Cities you can create Points and use LineStrings to create the routes and add a them as a GeoJson Layer to the map.