I want to show a different View below map (e.g. some animation), and need to make map partially transparent for this. How can I do this with CARTO Mobile SDK?
How to make transparent map background with CARTO mobile SDK
747 Views Asked by JaakL At
1
There are 1 best solutions below
Related Questions in ANDROID
- Add additional fields to Linq group by
- couldn't copy pdb file to another directory while consuming wcf web service
- Why are the aliases for string and object in lowercase?
- WPF MessageBox Cancel checkbox check
- Resolve object using DI container with object instance
- Creating a parametrized field name for a SELECT clause
- Does compiler optimize operation on const variable and literal const number?
- Get data from one form to another form in C#
- Writing/Overwriting to specific XML file from ASP.NET code behind
- Deleting Orphans with Fluent NHibernate
Related Questions in IOS
- Add additional fields to Linq group by
- couldn't copy pdb file to another directory while consuming wcf web service
- Why are the aliases for string and object in lowercase?
- WPF MessageBox Cancel checkbox check
- Resolve object using DI container with object instance
- Creating a parametrized field name for a SELECT clause
- Does compiler optimize operation on const variable and literal const number?
- Get data from one form to another form in C#
- Writing/Overwriting to specific XML file from ASP.NET code behind
- Deleting Orphans with Fluent NHibernate
Related Questions in CARTODB
- Add additional fields to Linq group by
- couldn't copy pdb file to another directory while consuming wcf web service
- Why are the aliases for string and object in lowercase?
- WPF MessageBox Cancel checkbox check
- Resolve object using DI container with object instance
- Creating a parametrized field name for a SELECT clause
- Does compiler optimize operation on const variable and literal const number?
- Get data from one form to another form in C#
- Writing/Overwriting to specific XML file from ASP.NET code behind
- Deleting Orphans with Fluent NHibernate
Related Questions in CARTO-MOBILE
- Add additional fields to Linq group by
- couldn't copy pdb file to another directory while consuming wcf web service
- Why are the aliases for string and object in lowercase?
- WPF MessageBox Cancel checkbox check
- Resolve object using DI container with object instance
- Creating a parametrized field name for a SELECT clause
- Does compiler optimize operation on const variable and literal const number?
- Get data from one form to another form in C#
- Writing/Overwriting to specific XML file from ASP.NET code behind
- Deleting Orphans with Fluent NHibernate
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Ok, thanks for asking, this actually wasn't the most trivial task.
Details depend what parts of map you want to make transparent. Let's assume you want to sea areas transparent. Essentially, you have four different levels that need to be transparent then:
My example snippets are in Swift, but should be easily convertible to other languages.
In Carto's Mobile SDK, the land is actually solid background color covering whole map, water is placed on top of it as blue (or dark)-colored polygons. So if you wish to make the water layer transparent, you also need to make the map background transparent, but this creates also transparent land. To avoid this you need to 'color' land side with some polygons; normal vector tiles do not have land coverage, but we have created special tileset in a mapbox account, what you can use as VectorTileLayer:
Now that you've got your land area colored, you would add another layer with real basemap. For this we need a customized basemap style - with transparent water/sea - and bundle it with your app. Carto's Voyager style is available here.
Unzip it, and make the following changes in the following files:
hydro.mss:
style.mss:
Compress the files (make sure there is no folder in zip, else the SDK won't find any files) and add the new style to your
assets
folder (if Android) or anywhere (if iOS).Now you can load your style from an asset file like this:
Then set your GlView's background transparent, and set mapview background bitmap to null, and you're ready to go:
When you're developing Android, you also need to add the following two lines for the transparent NTMapView background to properly render, else it'll stay black:
Here I've set the parent views background to red. Now I see the following when the MapView renders: