Travel Mapping

Web Design Discussion => General Web Design Discussion => Topic started by: mapcat on February 29, 2016, 07:59:12 pm

Title: Opacity of base maps
Post by: mapcat on February 29, 2016, 07:59:12 pm

How possible would it be to make the opacity of the base maps user-controlled? For example, the US Census Bureau's TIGERWeb features an opacity slider on its maps.


https://tigerweb.geo.census.gov/tigerweb/


(expand any category in the layers menu to see it)
Title: Re: Opacity of base maps
Post by: Jim on February 29, 2016, 08:11:45 pm
Do you mean the background map tiles?  If so, only if Google's API has that level of control, I think.


How possible would it be to make the opacity of the base maps user-controlled? For example, the US Census Bureau's TIGERWeb features an opacity slider on its maps.


https://tigerweb.geo.census.gov/tigerweb/


(expand any category in the layers menu to see it)
Title: Re: Opacity of base maps
Post by: mapcat on February 29, 2016, 08:19:49 pm
Do you mean the background map tiles?  If so, only if Google's API has that level of control, I think.
That's right. Thanks.
Title: Re: Opacity of base maps
Post by: theFXexpert on March 02, 2016, 11:01:26 am
Somewhat relevant: I submitted a pull request that implements a blank map layer as described in this issue (https://github.com/TravelMapping/Web/issues/18).

https://github.com/TravelMapping/Web/pull/46

After playing around with Chrome's JS console, google does have functions for setting opacity for defined map types: map.mapTypes.Mapnik.setOpacity(0.5) for example.
I have only been able to get it to work with the MQOpenMap, MQOpenSat, and Mapnik layers. For whatever reason this doesn't work on google's built-in layers.
Title: Re: Opacity of base maps
Post by: Jim on March 03, 2016, 08:39:23 pm
Somewhat relevant: I submitted a pull request that implements a blank map layer as described in this issue (https://github.com/TravelMapping/Web/issues/18).

https://github.com/TravelMapping/Web/pull/46

Thanks, I hope to get this and the other items that have been submitted tested out and (if all seems OK) live on the site in the next few days.
Title: Re: Opacity of base maps
Post by: yakra on March 04, 2016, 12:43:02 am
Sorry, this is a bit OT, but...
theFXexpert, IIRC you originally added the OpenMQ and Mapnik layers to the HB. Many thanks for that! At the time, I took a look at the CHM HB & Waypoint Editor, and tried to figure out how one might add in the code for BingMap and BingSat layers, but came up empty-handed. Do you have any insight here?
Title: Re: Opacity of base maps
Post by: theFXexpert on March 04, 2016, 12:32:04 pm
Sorry, this is a bit OT, but...
theFXexpert, IIRC you originally added the OpenMQ and Mapnik layers to the HB. Many thanks for that! At the time, I took a look at the CHM HB & Waypoint Editor, and tried to figure out how one might add in the code for BingMap and BingSat layers, but came up empty-handed. Do you have any insight here?
The MQOpen/Mapnik layers were actually very easy to add since the code for getting the tiles on CHM is visible in Chrome's Developer tools in maptypes.js. If I remember correctly, Jim already copied some of the maptypes.js code over into TM's JavaScript files with many of the lines commented out.

The Bing maps are a whole other deal though. The code for returning Bing tiles in CHM is returned from http://cmap.m-plex.com/hb/ymaptile.php along with a number of query string parameters. The code for that PHP file is not visible to me therefore, I don't know how to port the code over here.

After some googling, Bing uses a significantly different URL system for delivering tiles: http://stackoverflow.com/questions/3109595/integrating-bing-maps-tiles-into-google-maps-api
While the code given in one of the answers technically works, in order to dynamically generate valid tile URLs, a Bing Maps API Key is required: http://stackoverflow.com/questions/6278362/bing-maps-direct-access-to-tiles-and-api-key