-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FR] tool to edit style #174
Comments
What do you mean by JS example? If you use some JS framework, then the code depends on specific framework, it is hard to give generic samples for it. Regarding CartoCSS styling there are two ways to use it - (1) in style package (.zip) file, as with bundled and custom basemap styles. This is suitable for complex Layers with a lot of different styling data, including icons, texts/fonts etc. (2) For simple single-data case you can put CartoCSS to a String object and apply this to a vector tiled layer. I have a Java example code for this - it adds a Layer with polygons from a Mapbox account map. In similar way you can fetch vector tiles from a Carto account table. String css = "#land-polygons {\n" +
"polygon-fill: #FFFFFF;\n" +
"polygon-opacity: 1.0;\n" +
"}";
HTTPTileDataSource dataSource = new HTTPTileDataSource(0, 12, "https://a.tiles.mapbox.com/v4/jaakl.landpolygons-mz12/{z}/{x}/{y}.vector.pbf?access_token=pk.eyJ1IjoiamFha2wiLCJhIjoiR3FYNFJrRSJ9.n8PoOPy9tvnULFJ8h67pIA");
mapView.getLayers().add(new VectorTileLayer(dataSource, new MBVectorTileDecoder(new CartoCSSStyleSet(css)))); |
@jaakla i am using the style package (.zip) within android. |
Yes, it is not the same, so the carto.js and CARTO web tools (Builder) have same issue as kosmtik - they do not know mobile-specific cartocss additions; and as many of the additions are really mobile-specific then there is no plan to add them there. So the only tool which fully works with our CartoCSS is the Mobile Style Editor; it is also done with the mobile SDK can therefore it can render all the features. We are modifying the CartoCSS files manually ourselves, with Instant Run and a tool to edit text files directly in zip files (I have BetterZip) it is not that bad. |
@jaakla ok i get it about the different styles. Now about the Mobile Style Editor. I managed to get it to build but it crashes because of
Apparently CartoDB does not have a github repo |
Thanks for feedback! @Nikituh is checking this |
Hey there, @farfromrefug Yeah, we changed the logic of how and where we host our public styles, and forgot to update the editor application. It's fixed in master branch now, and I'll soon release new versions to HockeyApp as well. |
Can do, @farfromrefug ! Here it is: https://rink.hockeyapp.net/apps/477fcd9fba6d4c29be7d0256dfffac7e As far as I know, it hasn't been publicly tested by anyone yet, just used internally. If it crashes or you find any bugs, please be nice :) |
@Nikituh that was fast :D Thanks will test it! |
@jaakla that's it, found a way to do live update dead fast. |
@Nikituh just tried the new version. Now it connects correctly and download the templates juste fine. But the map does not load. Could it be the api key? Will try to build it to get the logs |
There does indeed seem to be a problem with the HockeyApp version. I'll try to get a fix up as soon as possible. As for the style documentation... Sadly, I have to say no, but it's a great idea. We'll probably create a small README/guide to our layers (and styles, in general) |
@Nikituh about the style doc that would be great. I would glad to help in any way! |
Hotfix uploaded to HockeyApp, @farfromrefug |
@Nikituh thanks will try it later as i don't have a ipad with me. |
@Nikituh Sorry it took me so long to test it. It works perfectly! And it gaves me a great idea. I am going to try make it a live edit thing from vscode to nativescript. Following the idea you used in the editor i think i can make it so that nativescript auto update on mss change from vscode or other editors. |
@Nikituh did you finally made public that readme file with the guide for the layers / styles? I'm in the need of editing the default.xml packed into the nutibright-v3.zip and seems to be a hard task to edit the file without having many clues about it. And I guess, there isn't any LIVE editor at the moment, right? |
Editing of the .xml is difficult indeed. We never do this, we use cartocss-based projection MB Studio Classic, which is used either as set of .mss files in style.zip, or as generated XML. To use max of SDK both cartocss and XML needs some manual adjustments. Unfortunately we don't have detailed guides about that, and do not have short term plans to add them just in case. Maybe with enterprise support contracts. |
I'm trying yo apply the solution you suggested, @jaakla , which is to apply the CartoCSS directly to the layer. In my case, I would like to draw the contour lines, and the labels, based on the MapTiler ones. The information from the contour lines is here https://cloud.maptiler.com/data/contours/ Here I attach the JSON link with a testing key so you can directly see the information: https://maps.tilehosting.com/data/contours.json?key=OhIrANXYBfS56VwqOYW5 You can observe that there are 2 fields, I changed the variable, from |
There is a real need for a tool to live edit cartocss style.
I tried to use kosmtik but i t wont render because most of the properties values are not recognized (linear, step, all nuti....)
I see you have https://github.com/CartoDB/mobile-style-editor but i don't even have a xamarin project to test it.
Also would be much simpler to have a simple js example to load a style.
I see that on your website:
https://carto.com/documentation/cartojs/examples/#example-edit-sql-&-cartocss
In the js code i see
cart.style.CartoCSS
, can it load mobile style project?The text was updated successfully, but these errors were encountered: