Is it possible to change the base style of a custom style after the fact in Mapbox Studio? If yes, how? I looked around the UI and in the documentation but couldn't find how.
Say I created a private style from the Vintage designer style (for example's sake), then added and customized layers by importing tilesets, can I switch to the another base style (e.g. North Star), or do I need to start a new custom style from the start?
Yes. Mapbox Studio is just a GUI for generating Javascript; it outputs a giant JSON file.
(A Mapbox Style is just a JSON object.)
Each of your data layers is included in that JSON (and can be copied and pasted into another style JSON).
Use these instructions to learn the process:
https://mapbox.com/help/transfer-styles-between-accounts
Hope that helps!
Related
I have an SVG asset of a map, in which I have to change the color of some cities depending on the results of a network call. On the web, one normally would add a class to each path, give it some CSS, and toggle that class using JavaScript.
How can I achieve the same effect in flutter?
This can be done with the new version of jovial_svg. It supports embedded stylesheets, so you can use CSS exactly as suggested. Of course, you'd need to re-parse the SVG whenever there's a change, but that's not a big deal here.
Alternately, if it's just one set of cities, you could use SVG's currentColor, and set that value in the appropriate ScalableImage factory. But for your use case, CSS seems like the better way to go.
NOTE: At this exact moment, CSS support is in pre-release, but it should be formally released as 1.1.4 within a couple of days. In the meantime, see https://pub.dev/packages/jovial_svg/versions/1.1.4-rc.3
I'd like to use the here maps vector tiles in a mapbox gl app. However, in order to do so, I need to define a style.json, see here for the spec, and here for an example.
Does here have a base style.json that I can use?
On the examples page, where using Mapbox is discussed, the documentation simply says: style: "map_style.json", // you should use your own style. It's a bit of a PITA (pain in the a**) to build from scratch, though.
Thanks for any help.
map_style.json -
this could be different for different use case and plain "JSON" file. This needs to be according to the map properties that needs to be displayed to use the other container style.
I have a dataset, created in mapbox from an original GEOJson file, and later associated to a tileset (aslo in MapBox Studio). It was parsed fine, and I could inspect it in Studio>Dataset, all properties were parsed.
This tileset is then used as a layer on a stylep; the points are displayed, but the point's descriptions are not displayed when using MapBox-gl-js.
What do I have to do to display those descriptions when clicking on a waypoint?
note: Adding them by hand when creating the map isn't my preferred solution. Can this be done transparently from the original dataset saved on mapbox servers?
You've tagged this post as mapbox-gl-js, but refer to MapBox-js - which library are you using?
Assuming you mean Mapbox GL JS (https://docs.mapbox.com/mapbox-gl-js), I modified this example of displaying data from a GeoJSON source to use a tileset from Studio instead - but it's the same underlying data. You can see it here.
I have created an OpenStreetMap server using this guide: switch to osm it's very good and works like a charm. I have also been able to add a new theme using TileMill and osm-brigth
However, I now want to be able to switch between two themes, osm-bright and osm-night. Is this an apache question or is there a way to modify mapnik to be able to get a parameter from for example openlayers to switch between these two themes?
Gratefull for any advice.
Install "OSM Night" style like the first one into a separate directory, download all required files.
Produce XML out of MML with carto -l project.mml > osm-night.xml, like you probably did with osm-bright.
Edit /etc/renderd.conf adding a second style section, like for osm-bright, but with names and paths to osm-night.
Restart renderd and apache2.
After that you will have two set of tiles generated: e.g. /osm-bright/{z}/{x}/{y}.png and /osm-night/{z}/{x}/{y}.png. Add both of them as tile layers to your OpenLayers page, and add a layer switcher. (I use Leaflet and not sure how it's done in OL).
I've got an example data set of lines and points, representing peoples' journey to work and where they feel at risk from road accidents.
Now, the data have attributes such as Place (Home, Work, Danger) and the severity of accidents they fear in different places. So the wider question is how to visualise this on a web map. For that I've looked into Google Maps, Leaflet and OpenLayers3. Each of these looks great and allow nice styling but none, to my eye, have the neatness of CartoCSS for fast, complex and intuitive styling, like the code below used to create the image below:
So I tried it out in tile mill and this is what I came up with, after converting the things to raster tiles via TileMill.
But this is a silly way to do things: it cannot overlay a base layer and would be much more efficient to just serve the vector data and style them in the client side, perhaps using something like mapbox.js. But I cannot work out how to use the lovely CartoCSS language in the client side to style GeoJSON files. (How) Is this possible?
p.s. here's how I styled the above map
#tlines {
line-width:1;
line-color: #0b0;
}
#tpoints.points{
marker-width: 6;
}
#tpoints.points[Place='Danger'] {
marker-fill:#db0d0d;
}
#tpoints.points[Place='Home'] {
marker-fill:#db0;
}
#tpoints.points[Severity='1']{
marker-width: 4;}
#tpoints.points[Severity='2']{
marker-width: 6;}
#tpoints.points[Severity='3']{
marker-width: 10;}
I cannot work out how to use the lovely CartoCSS language in the client side to style GeoJSON files. (How) Is this possible?
It is not possible to use CartoCSS for styling features browser side.
To learn how to style GeoJSON in Mapbox.js/Leaflet.js take a look at the docs here:
Styling GeoJSON in Mapbox.js https://www.mapbox.com/mapbox.js/api/v1.6.2/l-geojson/ (works exactly as in Leaflet.js as Mapbox.js is based on Leaflet.js)
You can embed style options directly into the GeoJSON object with L.mapbox.simplestyle.style https://www.mapbox.com/mapbox.js/api/v1.6.2/l-mapbox-simplestyle-style/
Alex rightly points out that vector styling in Leaflet/Mapbox.js is a different creature than CartoCSS styling a la Tilemill or Mapbox Studio. However, it is possible to style features in a browser using CartoCSS; it just requires one of two things:
A different platform: CartoDB has an excellent JS library for styling hosted data with CartoCSS, based on leaflet and fully compatible with Mapbox basemaps.
Hosting your own tile server, either the CartoDB server or a combination of Mapbox-built tools.
If you are using GeoJson as data source, you may try the Leaflet.geojsonCSS plug-in for Leaflet.js. The Geojson CSS provides the styling definition for each feature in the collection in a css-like format. Using this requires to add the styling definition in the geojson beforehand.