I want to draw L.circle in a custom pane but I am using mapbox.js and hence the leaflet version 0.7.7.How can I draw L.circle in a custom pane? Do we have to copy some js files from the 1.0 version of leaflet? Please help me and explain how to do this.
In leaflet source file search for function _initPanes(). Inside the function create a new custom pane and attach it to mapPane.
pane.myCustomPane = this._createPane('leaflet-mycustom-pane-css');
Update L.Circle code to attach the circle to your custom mapPane.
Related
I need to add a FeatureGroup to the overlays list. I do add some overlays when instantiating the Leaflet map, but I now need to append a FeatureGroup dynamically, ie. based on some run time conditions.
Can someone please help with appending the leaflet control layers? I simply cannot figure whether that's even possible at all. I can add the new layer to the map, but not to the overlays control section. I have also managed to add this new layer dynamically to a new control, but I need to append it to the existing control.
As a side note, I am trying to use Polymer on top of Leaflet map.
You can add new layers with control.addOverlay(layer, name).
And removing it from the control with control.removeLayer(layer)
I'm trying to add the contours layer from Terrain v2 to my style, but I can't get anything to show up. Does anyone know what I'm doing wrong? It's my top layer and I chose 'line' for type. screenshot
Can you please details what you have done so far?
You can follow these steps to move layers from one style to another
Go to the map style that has the styled layers
Select the styled layer you want to copy
Click the to access the JSON editor
Copy the JSON text
Go to the new style you want to add these layers
Add the layer you want to style by clicking +Add Layer
Select the newly added layer and go to the JSON Editor (see Step 3 to see how)
Delete what's in the JSON editor
Paste what you copied from Step 4 into the JSON editor
I am trying to create a navigation application using Mapbox GL JS. But the text labels are too small along with the searchbox. Where in the Mapbox GL JS API can we set the tilesize and ppi to fix it?
The best way to adjust the size of the text labels is to create a custom map style using Mapbox Studio, rather than programmatically manipulating the size of the map labels using the GL JS API (unless for some reason you need the text label size to be responsive on the client side).
You can navigate to studio.mapbox.com, select the New style button, choose a template to customize, and then click the Customize button. This will open the map editor interface, where you can navigate to the Layers panel on the lefthand side of the interface and select a layer whose properties you would like to edit.
For example, in the screenshots below I selected the state-label layer and changed the Text size property from 18px to 30px. More details about styling layer properties can be found in the documentation here.
To persist these changes to the map, you can publish your style, as described in the detailed documentation here. The way in which you can then add the custom map style to your application is dependent on the application you are developing for. The linked documentation specifies the appropriate steps for web, Android, iOS, Unity, and several other third party options.
I have some GeoJSON data containing some locations I'd like to show on my map.
Since it contains also the style (marker-icon, marker-size, etc.), right now I am using this data as
map.setGeoJSON(my_data);
These locations will never change, I want to add them as a Vector Tile. Is there a way to do that with MapBox studio?
I tried to put my_data in a file and load it in MBS, but I don't know how to style them as they were the default markers of MapBox.
Thank you
Since it contains also the style (marker-icon, marker-size, etc.)
Do you mean it follows MapBox's simplestyle spec? If so, this simplestyle is only intended to style geojsons in the browser, not vector tile sources in MapBox Studio.
If you want to style them in MapBox Studio, you have to use CartoCSS: create a Studio Source project with your geojson, and create a Studio Style project to style them w/ Carto. Checkout the maki icon set and reference the icons you want for each point using the marker-file: url("path/to/icon.png"); property.
Otherwise, you can load the geojson into your map in the browser using mapbox.js and apply their simplestyles.
I used Tilemill to style my data, added teaser for points, then save then uploaded the project at data on mapbox.com then referred to those data on my website using "Layers" on mapbox.js examples why are my tooltips not showing up?
You still need to add your gridLayer and gridControl to your addLayer function. Example.