Author Topic: Opacity of base maps  (Read 10625 times)

0 Members and 1 Guest are viewing this topic.

Offline mapcat

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 1773
  • Last Login:Yesterday at 11:09:41 am
Opacity of base maps
« 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)
Clinched:

Offline Jim

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 2856
  • Last Login:Yesterday at 10:14:42 pm
Re: Opacity of base maps
« Reply #1 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)

Offline mapcat

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 1773
  • Last Login:Yesterday at 11:09:41 am
Re: Opacity of base maps
« Reply #2 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.
Clinched:

Offline theFXexpert

  • TM Collaborator
  • Full Member
  • *****
  • Posts: 136
  • Gender: Male
  • Last Login:July 12, 2024, 01:20:07 am
Re: Opacity of base maps
« Reply #3 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/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.

Offline Jim

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 2856
  • Last Login:Yesterday at 10:14:42 pm
Re: Opacity of base maps
« Reply #4 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/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.

Offline yakra

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4422
  • Last Login:Yesterday at 10:18:34 pm
  • I like C++
Re: Opacity of base maps
« Reply #5 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?
Sri Syadasti Syadavaktavya Syadasti Syannasti Syadasti Cavaktavyasca Syadasti Syannasti Syadavatavyasca Syadasti Syannasti Syadavaktavyasca

Offline theFXexpert

  • TM Collaborator
  • Full Member
  • *****
  • Posts: 136
  • Gender: Male
  • Last Login:July 12, 2024, 01:20:07 am
Re: Opacity of base maps
« Reply #6 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