MapQuest, Leaflet + Angular.js

6 posts / 0 new
Last post
ephraimm
MapQuest, Leaflet + Angular.js

Hi

We have a project that uses angular with leaflet, (ui-leaflet angular directive) it is not so straight forward to use the mapQuest plugins together with angular leaflet directive.

Has anyone done any work with this? We are having trouble getting a single layers object with base layers and overlays to comply with the mapQuest plugin.

Any suggestions?

TIA.

Ephraim


MQBrianCoakley
There are angular plugins out
There are angular plugins out there they may help. Here is one with samples.

ephraimm
UI-leaflet & Mapquest don't play nice.

Hi Brian,

Thanks for the reply. We are already using those plugins that is the ui-leaflet directive that the angular team has forked from tombatossals. We are way down the road with angular and leaflet, we have done a ton of integration with it. we now want to use mapquest, but the automagic setup of layers doesn't play nice with the way the angular directive works with layers.


MQBrianCoakley
The plugin was definitely not
The plugin was definitely not built with angular in mind. But if you could post a sample url where we can see how it's not working we may be able to take a look.

ephraimm
angular layer integration

https://plnkr.co/edit/xARtBXwqmQLAIqD3pXLl?p=preview

basically I'm trying to use the layers object defined as

 layers: {
        baselayers: {
          osm: {
            name: 'Open Street Map',
            url: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
            type: 'xyz',
          }
        },
        overlays: {
          alerts: {
            name: "Alerts",
            type: "markercluster",
            visible: true
          },
        }
      }

 

then extended with the mq layers.

and an overlays object with alerts that I add markers to.

 


MQBrianCoakley
Sheesh, sorry I missed this.
Sheesh, sorry I missed this. But it appears to be working. I can see the MapQuest layers in the second map.