Skip to main content

I'm using the HTMLReportGenerator to build a simple HTML page with a map (and charts, tables, etc.). I'm trying to use the Mapbox leaflet option, but encountering some issues. Given I'm new to MapBox, I don't know if I'm just going about this the wrong way.

I can specify which MapBox style to use by entering mapid value, but this seems to work only for the default style - if I enter 'mapbox.light' as the map-id value then the MapBox Light map is returned - great. If I enter 'mapbox.mystyle-test' then I was expecting that my custom built style 'MyStyle-Test' from MapBox would be returned, but I get nothing returned. Have I missed something?

My second issue is styling data that I add to the map by passing the features into the HTMLReportGenerator. I've added a MapBoxStyler transformer before the HTMLReportGenerator to style my data (for example set points to a red circle). But when I build the map using the MapBox leaflet option and using the default mapbox style (mapbox.light), the output is still default point styling (blue) on top of the map. Again am I missing something?

Thanks for any help

Hi @1spatialmary - With regards to your first question,... I'm not sure Styles are supported by the Mapbox Leaflet in HTMLReportGenerator.

It appears that the Map Id parameter must be – for example – one of the ids listed here: https://www.mapbox.com/api-documentation/#maps

The Styles appear to be referenced differently... see image below.

0684Q00000ArKYSQA3.png

The full URL, with reference to Styles, would be similar to:

https://api.mapbox.com/v4/mapbox.outdoors/{z}/{x}/{y}.png?access_token=<token>&style;=mapbox://styles/<user>/<style_id>

You could try editing the HTML document that HTMLReportGenerator creates,.. but that might be too much overhead.

I don't know too much about creating Mapbox Styles, so I wasn't able to confirm if this would work or not.. but try editing the attached HTML (created with HTMLReportGenerator). Specifically, replace the L.mapbox.accessToken and L.mapbox.style parameters with your valid information.

Hope this helps! It might be a great idea.. to submit an Idea for Styles support.

mapbox.htm


Hi @1spatialmary - With regards to your first question,... I'm not sure Styles are supported by the Mapbox Leaflet in HTMLReportGenerator.

It appears that the Map Id parameter must be – for example – one of the ids listed here: https://www.mapbox.com/api-documentation/#maps

The Styles appear to be referenced differently... see image below.

0684Q00000ArKYSQA3.png

The full URL, with reference to Styles, would be similar to:

https://api.mapbox.com/v4/mapbox.outdoors/{z}/{x}/{y}.png?access_token=<token>&style;=mapbox://styles/<user>/<style_id>

You could try editing the HTML document that HTMLReportGenerator creates,.. but that might be too much overhead.

I don't know too much about creating Mapbox Styles, so I wasn't able to confirm if this would work or not.. but try editing the attached HTML (created with HTMLReportGenerator). Specifically, replace the L.mapbox.accessToken and L.mapbox.style parameters with your valid information.

Hope this helps! It might be a great idea.. to submit an Idea for Styles support.

mapbox.htm

Thanks @RylanAtSafe for your response.

 

I'll add an idea as you suggested.

 

I'm also unable to find any reference to mapbox in the html file you sent, i.e. I can't find L.mapbox.accessToken or L.mapbox.style to try replacing it - can you attach again please?

 

Thanks

Hi @1spatialmary - With regards to your first question,... I'm not sure Styles are supported by the Mapbox Leaflet in HTMLReportGenerator.

It appears that the Map Id parameter must be – for example – one of the ids listed here: https://www.mapbox.com/api-documentation/#maps

The Styles appear to be referenced differently... see image below.

0684Q00000ArKYSQA3.png

The full URL, with reference to Styles, would be similar to:

https://api.mapbox.com/v4/mapbox.outdoors/{z}/{x}/{y}.png?access_token=<token>&style;=mapbox://styles/<user>/<style_id>

You could try editing the HTML document that HTMLReportGenerator creates,.. but that might be too much overhead.

I don't know too much about creating Mapbox Styles, so I wasn't able to confirm if this would work or not.. but try editing the attached HTML (created with HTMLReportGenerator). Specifically, replace the L.mapbox.accessToken and L.mapbox.style parameters with your valid information.

Hope this helps! It might be a great idea.. to submit an Idea for Styles support.

mapbox.htm

Idea posted at https://knowledge.safe.com/idea/50512/support-styles-for-mapbox-in-htmlreportgenerator.html

 

 


Bit late to respond here, but I just realized I did something like this:

It's a custom aerial photo that's saved in MapBox as a tileset.

But I can't seem to do this with map styles...


Hi, I am trying to do the same, any chance you could share a workspace.

 

 


Thanks @RylanAtSafe for your response.

 

I'll add an idea as you suggested.

 

I'm also unable to find any reference to mapbox in the html file you sent, i.e. I can't find L.mapbox.accessToken or L.mapbox.style to try replacing it - can you attach again please?

 

Thanks
@1spatialmary - It appears that clicking the .htm attachment will attempt to load it. Please right-click and choose "Save As" – or use the attached .zip file. And I'm sorry for the delay in response.. I was out of the office for an extended period of time!

 

10077-mapboxhtm.zip

 


Reply