angular-ui / ui-leaflet

AngularJS directive to embed an interact with maps managed by Leaflet library
http://angular-ui.github.io/ui-leaflet
Other
314 stars 134 forks source link

custom layers #34

Open nmccready opened 9 years ago

nmccready commented 9 years ago

From @robotnic on December 11, 2014 14:49

I wan't to use 2 special layers

https://github.com/glenrobertson/leaflet-tilelayer-geojson and https://github.com/afsuarez/mapsforge-cordova-plugin

I have seen "custom" layer in the source code, but I don't know how to use that.

Copied from original issue: tombatossals/angular-leaflet-directive#564

nmccready commented 9 years ago

From @porjo on January 16, 2015 0:59

Have you looked at the examples here: http://tombatossals.github.io/angular-leaflet-directive

nmccready commented 9 years ago

From @ageblade on August 30, 2015 7:5

Hi, this is the way you can use custom layers (This example use leaflet IIP plugin)

$scope.layers.overlays["iip"] = {
    name: 'iip',
    type: 'custom',
    visible: true,
    layer: L.tileLayer.iip(url, options)
};

Just initialize your custom layer into the layer property and set a name, visible and type = 'custom'.

Good luck,

xandros6 commented 8 years ago

Hi I try with follow custom layer:

var poi = {
          name:'POI',
          type: 'custom',
          visible: true,
          layer: L.geoJson(data, {
            pointToLayer: function(feature, latlng) {
              return L.marker(latlng, {icon: 
                L.AwesomeMarkers.icon({
                  icon: 'icon-wine',
                  markerColor: 'red',
                  prefix: 'icon'
                }), opacity:0.8, fillOpacity: 0.3});
            }
        })
        };

but when I add it to layers with :

$scope.map_layers.overlays.poi = poi;

I receive a

RangeError: Maximum call stack size exceeded at equals (ionic.bundle.js:14421)

If I use

geoJSONAwesomeMarker

all is OK but I not have my custom settings.

Can you help me please?