Giter Site home page Giter Site logo

angular-ui / ui-leaflet Goto Github PK

View Code? Open in Web Editor NEW
316.0 26.0 137.0 34.02 MB

AngularJS directive to embed an interact with maps managed by Leaflet library

Home Page: http://angular-ui.github.io/ui-leaflet

License: Other

JavaScript 77.35% CoffeeScript 12.84% HTML 9.32% CSS 0.49%
leaflet-map maps angular ui-leaflet leaflet-directive gis leaflet

ui-leaflet's Introduction

Angular Leaflet

Why the fork?

While we are grateful for all the original work at tombatossals/angular-leaflet-directive. We need to be able to operate as an organization to respond to issues, pull-requests and other various items quicker. We need to be able to add other developers as admins easier via group permissions via github orgs. Lastly this project needs to be more credible via being a group / org.

Master Branch State

Please note the master branch is currently in a "in-progress state" and is not suitable for use at this point. We are trying break up the library to be more unix / plugin like. This will reduce the burden of constant changes to the core repo (this repo) for each and every unforseeable plugin that leaflet has. Therefore, the new usage plugins will require developers (angular-ui or not) to create specific angular directives, services, factories, and etc to extend the main ui-leaflet directive. Where ui-leaflet would be the main dependency.

Examples:

How to extend: Create new directives, factories, and services specific to plugins. Use the decorator pattern to extend existing services, factories and directives. Specifically see ui-leaflet-draw as it decorates ui-leaflet.

More about decorators:

Goal

AngularJS directive for the Leaflet Javascript Library. This software aims to easily embed maps managed by Leaflet on your project.

Join the chat at https://gitter.im/angular-ui/ui-leaflet CDNJS

Build Status Dependenciesย  Dependencies Coverage Status

Examples

Browse all the examples added by the community to learn about the directive and its possibilities.

Documentation

See https://angular-ui.github.com/ui-leaflet

How to use it

Include angular-simple-logger before Angular-Leaflet js files. Logger gets installed as a requirement of Angular-Leaflet with bower install or npm install. Note that if you're using the browser to load it without CommonJS (browserify, webpack) please use angular-simple-logger.js (not index.js).

Include the ui-leaflet dependency on your Angular module:

var app = angular.module('demoapp', ['nemLogging','ui-leaflet']);

After that, you can change the default values of the directive on your angular controller. For example, you can change the tiles source, the maxzoom on the Leaflet map or the polyline path properties.

angular.extend($scope, {
    defaults: {
        tileLayer: 'http://{s}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png',
        maxZoom: 14,
        path: {
            weight: 10,
            color: '#800000',
            opacity: 1
        }
    }
});

If you want to set the start of the map to a precise position, you can define the "center" property of the scope (lat, lng, zoom). It will be updated interacting on the scope and on the leaflet map in two-way binding. Example:

angular.extend($scope, {
    center: {
        lat: 51.505,
        lng: -0.09,
        zoom: 8
    }
});

If you need to run any method on the map object, use leafletData as following (notice the map object is returned in a form of a promise):

angular.module('myModule').controller('MapController', ['$scope', 'leafletData',
    function($scope, leafletData) {
        leafletData.getMap().then(function(map) {
            L.GeoIP.centerMapOnPosition(map, 15);
        });
    }
]);

Finally, you must include the markup directive on your HTML page:

<leaflet defaults="defaults" lf-center="center" height="480px" width="640px"></leaflet>

If you want to have more than one map on the page and access their respective map objects, add an id attribute to your leaflet directive in HTML:

<leaflet id="mymap" defaults="defaults" lf-center="center" height="480px" width="640px"></leaflet>

And then you can use this id in getMap():

angular.module('myModule').controller('MapController', ['$scope', 'leafletData',
    function($scope, leafletData) {
        leafletData.getMap('mymap').then(function(map) {
            L.GeoIP.centerMapOnPosition(map, 15);
        });
    }
]);

ui-leaflet's People

Contributors

aleksandrov avatar anwalkers avatar bzmw avatar cachiconato avatar cschwarz avatar danielepiccone avatar davidovich avatar dremonkey avatar eczajk1 avatar elesdoar avatar fbarnard avatar fwitzke avatar grantlucas avatar hooloovooblu avatar houqp avatar j-r-t avatar jaumefigueras avatar jehope avatar jesserosato avatar johnlindahltech avatar justinmanley avatar kozer avatar markaphillips avatar nblu avatar nmccready avatar pieterjandesmedt avatar pomahtuk avatar simison avatar skalb avatar tombatossals avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ui-leaflet's Issues

MultiMaps controll error

From @starikan on January 12, 2015 12:28

Hi.

http://jsfiddle.net/rm7r1jbz/8/ - When I click on map, then hide the layer with markers.

Error in console: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.

If you comment out this line then the error disappears - https://github.com/tombatossals/angular-leaflet-directive/blob/master/src/directives/layers.js#L163

I think this error similar with this issue - Leaflet/Leaflet#2877

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

trouble drawing polyline

From @cleechtech on June 30, 2014 15:4

I am trying to draw a polyline on my map to connect points. This object gets attached to $scope.allPaths on click.

{
  "path70601000211": {
    "color": '#008000',
    "weight": 8,
    "latlngs": [
      {
        "lat": "-1.29048",
        "lng": "36.827999"
      },
      {
        "lat": "-1.291455",
        "lng": "35.828468"
      },
     {
        "lat": "-1.290858",
        "lng": "37.828182"
      }
    ]
  }
}

This is the map directive

<leaflet center="nairobi" 
    paths="allPaths"
    height="480px" 
    class="col-md-12"></leaflet>

When I click the above object attaches to the scope but the polyline does not draw. How can I draw the line on my map?

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

Unable to use controllerAs syntax on controls attribute

From @Raptormstr on April 2, 2014 14:1

jQuery considers the attribute "controls" as a reserved word and will rename any string to simple "controls". Look at the jQuery.js source code lines 623 & 6888 for 2.1.0 and 665 & 7960 for 1.11.0. I do not believe jqLite has this same issue.

For example:
Before $compile:
After $compile:

NOTE: I removed the other attributes and classes for brevity.

The only workaround if jQuery is required is to use the variable name "controls" and assign it to the $scope.

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

Change coordinate reference system (CRS) dynamically

From @muenchdo on June 27, 2014 14:59

Is it possible to change the coordinate reference system (CRS) dynamically?

I have managed to initialize the map with different CRS by passing a Leaflet CRS object (e.g. L.CRS.EPSG3857) into defaults, but when I change this object the change is not reflected on the map.

There is a fiddle which does this with regular Leaflet.js, where this also requires to redraw the layer. I thought I could maybe do this by setting the baselayers object to {} and then adding my baselayers back in, but that also doesn't work.

Would be great if someone could help out!

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

Should the directive to be defined within ng-view or outside when the map is only to be shown in a route

From @gotaheads on June 16, 2014 6:31

Hi,

I've used leafletjs with Angular without this directive, which I've reused a map without recreating it to prevent the memory leak.

My experience is if you create a map within the ng-view and discard when navigating away, the leafetmap has many orphaned divs in DOM.

My question: is this directive designed to be used within the ng-view or there should be only one directive created in app?

Thanks in advance.

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

Clustering with groups shows cluster AND markers

From @l0c0luke on March 9, 2014 15:27

I like this new example that doesnt use layers since i only want a single "layer" of guests on the map. I loop throguh my guests, make sure they can be on a map, then I add them. I also use the leafletBounds to be able to set the bounds of the map but I have tried this without using bounds and I had the same result. The result is that the clusters are showing up on the map, but so are the individual pins.

I do do some map resizing based on events which resizes the container and then invalidates the map to resize it.

The things I can think of is that the markers array does not have individual key names as i just push the marker object onto the array. The code is below.

var leafletLatLngs = [];
$scope.markers = [];
_.each($scope.guests, function(guest) {
    var message = '';
    if (guest.image && !guest.images) {
        message += '<img src="'+guest.image+'" class="img-rounded pull-left" style="margin-right: 10px; width: 50px;">';
    } else if (guest.images) {
        message += '<img src="' + guest.images["50x50"] + '" class="img-rounded pull-left" style="margin-right: 10px;">';
    } else if (!guest.image && guest.fb_id != 0) {
        message += '<img class="img-rounded pull-left" src="https://graph.facebook.com/'+guest.fb_id+'/picture?type=large" style="max-width: 50px; margin-right: 10px;">';
    }

        if (guest.current_lat && guest.current_lng) {
            message += '<h4 style="margin-bottom: -10px; min-width: 200px;"><a href="/e/'+$scope.event.slug+'/guest/'+guest.slug+'">'+guest.name+'</a></h4><br>Currently at: '+guest.current_location+'<div style="clear:both;"></div>';
            var marker = {
                group: 'guestGroups',
                lat: parseFloat(guest.current_lat),
                lng: parseFloat(guest.current_lng),
                message: message
            };
            $scope.markers.push(marker);

            var latLng = new L.LatLng(guest.current_lat, guest.current_lng);
            leafletLatLngs.push(latLng);
        }
});

var leafletBounds = new L.LatLngBounds(leafletLatLngs);
if (leafletBounds.getSouthWest()) {
    $scope.bounds = {
        southWest: {
            lat: leafletBounds.getSouthWest().lat,
            lng: leafletBounds.getSouthWest().lng
        },
        northEast: {
            lat: leafletBounds.getNorthEast().lat,
            lng: leafletBounds.getNorthEast().lng
        }
    };
} else {
    $scope.noMapData = true;
}

$scope.events = {
    map: {
        enable: ['click', 'drag', 'blur', 'touchstart'],
        logic: 'emit'
    }
};

$scope.$on('leafletDirectiveMap.touchstart', function(event){
    $scope.expandMap();
});
$scope.$on('leafletDirectiveMap.drag', function(event){
    $scope.expandMap();
});

$scope.$on('leafletDirectiveMap.click', function(event){
    $scope.expandMap();
});

$scope.$on('leafletDirectiveMap.blur', function(event){
    if ($scope.width < 768 && $scope.mapExpanded) {
        $scope.resizeMap();

        $scope.mapExpanded = false;
    }
});

and then the leaflet map code is called with this in the html...

<leaflet id="guestmap" width="100%" height="100%" event-broadcast="events" markers="markers" bounds="bounds" style="margin-top: -20px; position: fixed; z-index: 1000;"></leaflet>

If you have any advice it would be greatly appreciated.

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

Fix gh-pages

Fix broken urls and project references. Get it up and running.

Is there a way to set active base layer ?

From @uygardonduran on June 2, 2014 14:26

Hi,
I'm using the layers attribute for my fixed baselayers. I want to store and load the user's base layer selection in the localstorage so I need to set the base layer at start up.
With introducing an eg. activeLayer option and making a small change in the angular-leaflet code I could do it. Or I tried to use setting top = true for the active layer at start up, but that also ruins the order of the options in the layer control UI, making the active layer on top. ( I don't want this. ) Anyway maybe there is a simpler way to do this without changing the code. That's what I want to know.

Thanks.

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

path not being displayed in map

From @zebarahman on January 25, 2015 17:34

hi, im using angularjs + ionic framework + leaflet.js. i want to show paths, i followed the paths example code, but the path is just not showing up. i added the modules in the same order as in the example ...the map centers to the given location and also shows markers if i specify there but the paths don't appear, what am i doing wrong?

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

Redraw map after width change by div

From @JoergPf on December 4, 2014 12:28

Hi, I have a map in a bootstrap div:

<div class="col-xs-10 col-xs-offset-1" id="kartencol">
          <leaflet defaults="defaults" center="center" paths="meinePfade" bounds="bounds"     decorations="decorations" width="100%" height="480px" markers="markers"></leaflet>
</div>

Then I use jquery and css animation to change the width of the col div and put a form next to it.

$('#kartencol').toggleClass('col-xs-10 col-xs-7')
$('#formcol').toggleClass('col-xs-0 col-xs-3')

It works great, but when I now do something with the map like setting bounds, angular still thinks I have the old map width.

How do I do a redraw or anything else with the map, to let angular know about the new width?

Best
Joerg

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

Cannot use leaflet directive multiple time at once.

From @wayofspark on March 19, 2014 15:58

Hello,

The _leafletMap directive variable singleton in the root directive cause leaflet to crash in various way if more than one map is used at the same time in the application. ( all maps use the variable, causing previous maps to loose reference to their own map at one point )

Fix should be easy using a scope variable instead of directive singleton to store the map promise.

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

Listen markercluster click event

From @markitosgv on July 15, 2014 18:1

Its possible to acces clusterclick, without overlays??

My initial map:

//map initial
    angular.extend($scope, {
        center: {
            autoDiscover: true
        },
        defaults: {
            scrollWheelZoom: false
        },
        layers: {
            baselayers: {
                osm: {
                    name: 'OpenStreetMap',
                    url: 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
                    type: 'xyz'
                }
            }
        }
    });

And then i call my own service to fecth markers data:

    //on load map
    $scope.$on('leafletDirectiveMap.load', function(event){

       api.getMarkersByProximity(function(data){
             $scope.markers.push(data);
        });

       });

Now i have a map with markers and clusters.
With this event i can listen when a marker is clicked, but not a cluster:

$scope.$on("leafletDirectiveMarkersClick", function(event, args){
        console.log($scope.markers[args]);
    });

Its possible to do?? thanks
I donยดt want when cluster marker is clicked to expand child markers... i want to get child markers data to do another thing.

On official Leaflet.markercluster docs says:

markers.on('clusterclick', function (a) {
    console.log('cluster ' + a.layer.getAllChildMarkers().length);
});

Is any event directive to listen?

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

Title property for markers in markercluster group after filtering

From @mukhtyar on March 21, 2014 17:4

I am trying to find a marker within a markerclustergroup overlay by using the following code:

$timeout(function(){    
          leafletData.getLayers().then(function(layers) {
              $scope.markerClusterGrp = layers.overlays.locations;
              var clusters = $scope.markerClusterGrp.getLayers();
              for (var i in clusters){
                if (marker.title == clusters[i].options.title) {
                  childMarker = clusters[i];
                  break;
                } 
             }
          });       
},1000);

I'm assuming that the options.title property in the clusters object is same as the marker.title property that I initially defined while creating the markers. However once I apply a filter to the markers, the options.title property in the clusters object does not match up. To illustrate this I have created a fiddle:

http://jsfiddle.net/mukhtyar/pHeKJ/

If you open up the console and play around with the filter you will see a log of the $scope.marker titles and clusters options.titles.

I am not sure if my assumption about .title is incorrect or if this is a bug. Is there a better way to find a marker within a markerclustergroup? My eventual objective is to find the parent cluster of this marker and highlight it on a mouseover event. I am using latest v. of this directive, and angular 1.2.8. Thanks!

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

Latency using markercluster with 15K points

From @vadvv on May 19, 2014 15:12

I'm having a problem clustering a large number of points (my current set is 40K+ points, but I've even gone down to about 15K points). It takes very long to cluster, and then when zooming in/out it takes similar time for the layer to render. Most of the time the browser (in my case Chrome) asks to kill the tab.

I should add that to overcome this, I had decided to show the data as a heat map until a zoom level is reached, after which I thought I could show the cluster, but that didn't seem to help either and resulted in the same delay.

These are my layerOptions:
layerOptions: {
"chunkedLoading": true,
"showCoverageOnHover": false,
"removeOutsideVisibleBounds": true,
"chunkProgress": updateProgressBar
}

I see that there's a leafletjs example that clusters 50K points pretty gracefully:
http://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-realworld.50000.html

Here's a fiddle demonstrating the behavior:
http://jsfiddle.net/redgis/BLW4p/

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

How can I access a control?

From @milovanderlinden on October 28, 2015 20:2

I have a custom button, somewhere in my angular bootstrap-ui page. From this button, I want to show or hide the minimap.

I know that leaflet has no way of telling which controls are loaded in the map, but does your wonderful directive offers this option?

For the history control I ended up declaring it in my controller and then accessing it's functions.

screenshot from 2015-10-28 20-59-52

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

bounds is not set after initial map load

From @jasadams on March 25, 2014 13:22

I know the way bounds and center was reworked recently. One side effect of this improvement is that after the inital load of my map, the bounds are not set. It is not until I pan or zoom the map that the bounds are set.
I did a little initial investigation and it seems that the listener for the "boundsChanged" event in the bounds directive is not set up in time for the initial broadcast of this event when the center is set in the center directive. The listener is inside a Map.whenReady promise and the map is not ready when the initial center is set.

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

static labels not working with leaflet labels and markercluster

From @muuuub on December 25, 2014 2:42

Static labels won't show up in angular-leaflet-directive using markercluster.

Here is my marker:

m1: {
    lat: 51.5,
    lng: 0,
    focus: true,
    draggable: false,
    group: "my_cluster_group",
    label: {
        message: "Hi there",
        options: {
            noHide: true
        }
    }
}

If noHide: false then the label will show up if you over over the marker, but it won't be a static label.

There was an issue filed on the leaflet.label github related to this:
Leaflet/Leaflet.label#35

However the issue was marked as fixed (for desktop), so I think this problem might be something to do with angular-leaflet-directive.

I'm using:

leaflet.label 0.2.1
markercluster 0.4.0
leaflet 0.7.3
angular-leaflet-directive 0.7.9

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

Add the ability to change the watch options on paths

From @cgat on December 9, 2014 0:59

I'm building a map that displays realtime path data to the user using polling. On each poll interval, I update the paths property with a new updated path object, which contains a latlng array that can amass up to 4000 coordinates.

With the way the paths directive has been implemented, there is a 'deep watch' (ie scope.watch("", fn, true) on both the paths scope variable, but also on each individual path object. With big paths, thats some head dirty checking overhead on each digest loop.

By changing the paths $watch to a $watchCollection and removing the 'deep watch' true parameter from the individual path watches, I achieved huge performance gains.

So my questions are:

  1. Should this be the default behaviour? The downside is that this would be a breaking change.
  2. If not default, how would you like the api for modifying the watch options for paths to be implemented?

I can make a pull request, but I thought I would get your input before moving ahead.

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

Extending markers

From @rtp-calpoly on December 27, 2014 19:14

I am currently using both angular-leaflet-directive and some "fancy" markers called MovingMarkers that you can find in the following repository:

https://github.com/ewoken/Leaflet.MovingMarker

Right now, I think that angular-leaflet has no support for them (please correct me if I am wrong); so I was thinking on trying to extend angular-leaflet so that I can handle them as a regular marker and not apart. Could somebody help me with the following basic questions?

  1. Is there any guide/example that I can use as a base for extending angular-leaflet in order to support this type of markers?
  2. MovingMarker has not been registered in Bower yet, so I was wondering if doing that first would be appropriate for integrating them better later in angular-leaflet.

Thanks in advance for the help.

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

[AngularJS - Leaflet] Invalid data passed to the polyline path

From @cleechtech on March 12, 2014 12:31

I'm trying to draw a path when a user clicks a certain element. In my view I have the directive:

<leaflet 
        center="nairobi" 
        paths="paths" 
        markers="markers" 
        defaults="defaults" 
        height="600">
    </leaflet>

Then in my controller I fetch the data points and add them to $scope.paths

   // function to draw path on map
    $scope.drawRoute = function(shape_id){
        // get path coordinates
        Route.getCoords(shape_id, function(points){
            var newPath = {
                color:'red',
                weight: 4,
                latlngs: []
            };

            // create array of latlngs
            angular.forEach(points, function(point){
                 // each point looks like this: ["1001", "-1.320547", "36.70583"]
                var coord = {
                    lat: point[1],
                    lng: point[2]
                };
                newPath.latlngs.push(coord);
            });
            var pathName = shape_id;

            // add path to $scope
            $scope.paths[pathName] = newPath;

        }, function(error){
            $scope.routeToDraw  = error;
        });
    };

    // generate map
    angular.extend($scope, {
        nairobi: {
            lat: -1.284381, 
            lng: 36.809031,
            zoom: 12
        },
        paths: {
            defaultPath: {
                color: 'red',
                weight: 4,
                latlngs: [
                        { lat: -1.284381, lng: 36.700974 },
                        { lat: -1.31349, lng: 36.699959 },
                        { lat: -1.311739, lng: 36.698589 }
                ],
            }
        },
        markers: {},
        defaults: {
            scrollWheelZoom: false
        }
    });

The defaultPath shows up fine when the page loads, but when I click an element I get an error:

[AngularJS - Leaflet] Invalid data passed to the polyline path angular.js:9383
TypeError: Cannot call method 'on' of undefined

How can I draw a path when a user clicks an element?

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

Optimizing geojson directive to use addData method

From @facultymatt on January 19, 2015 16:0

Currently the geojson directive works by removing the geojson layer and creating it from scratch on every change.

This is not performant, and is not needed in many cases, for example:

  • When a new element is added to an array of geoJson data
  • When an existing element is removed (although limitations exist since there is no removeData method, see Leaflet/Leaflet#1416)

For the first point, we could use the addData API to eliminate the need for removing the entire layer.


Additionally, what is the most performant way to use the directive as it currently exists? Any tips on this?

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

Leaflet.draw

From @aaronsharper on March 26, 2014 2:33

Trying to get the Leaflet.draw controls to work correctly. I can get the controls to show up on the map, and I can detect when the "draw:created" event is triggered, but when the layer is added to the map, the edit functionality doesn't work. I am guessing this is because I am supposed to add the layer to the "drawnItems" featureGroup, but that doesn't seem available from the directive in my controller. Am I missing something? Is there a way to get the declared "drawnItems" value from the directive from my controller? I am sure this is user error on my part.

Thanks in advance.

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

change map tileLayer

From @JoergPf on December 13, 2014 8:27

Hi,

how do I change the tileLayer after the first init?

I tried

$scope.defaults.tileLayer = "http://tile.stamen.com/#toner/{z}/{x}/{y}.png";

and

L.tileLayer('http://tile.stamen.com/#toner/{z}/{x}/{y}.png');

and also both with a

$scope.$apply(function(){
               $scope.defaults.tileLayer = "http://tile.stamen.com/#toner/{z}/{x}/{y}.png";
                //L.tileLayer('http://tile.stamen.com/#toner/{z}/{x}/{y}.png');
            });

How does this work?

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

Usage with browserify and NPM?

From @wobblydeveloper on July 4, 2014 20:4

I see this is an NPM module. I can't seem to figure out how to include it using browserify. Including it like so after the usual npm install --save angular-leaflet-directive....

var angular_leaflet_directive = require('angular-leaflet-directive');

... fails with...

Cannot find module 'angular-leaflet-directive'

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

Make marker message/label clickable?

From @wootwoot1234 on May 25, 2014 1:37

I'm trying to make my marker popups clickable. When I use html in the marker popup the html is rendered correctly but ng-click doesn't work. Here's what I have.

 $scope.map.markers.push({
    lat: lat,
    lng: lng,
    message: '<span ng-click="openView()">' + data.results[i].locationName + '</span>',
    draggable: false
});

Anyone know what I'm doing wrong or know how to call a function when the marker popup is clicked?

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

getNorthWest and getSouthEast in map.getBounds

From @daniel-obadia on June 27, 2014 20:41

Hi!

Is there a way for me to get the NorthWest and SouthEast object in the map.getBounds function?

When I console.log map.getBounds(); I only seem to be getting the NorthEast and SouthWest lat and lng.

I read some comments and have been able to get the correct lat and lng that I'm looking for. However, they dont update when the map is dragged as the NorthEast and SouthWest lat and lng update.

How can I use the leafletBoundsHelpers service to get this information?

Here is my current code

  leafletData.getMap().then(function(map) {
    var bounds = map.getBounds();
    var southEast = bounds.getSouthEast();
    var northWest = bounds.getNorthWest();
    console.log (southEast);
    console.log (northWest);

    $scope.southEast = southEast;
    $scope.northWest = northWest;


  var bounds = leafletBoundsHelpers.createBoundsFromArray([
    [ 51.508742458803326, -0.087890625 ],
    [ 51.508742458803326, -0.087890625 ]
  ]);

    <div class="row">
                Latitude northWest: <input type="number" step="any" ng-model="northWest.lat">
                Longitude northWest: <input type="number" step="any" ng-model="northWest.lng">
    </div>
     <div class="row">
                Latitude SouthEast: <input type="number" step="any" ng-model="southEast.lat">
                Longitude SouthEast: <input type="number" step="any" ng-model="southEast.lng">
     </div>

Thanks!

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

Overlay visibility attribute always false

From @bubblepixel on July 1, 2014 11:37

I have two overlays which are both groups. I set both to have no visibility initially:

overlays: {
jobs: {
name: 'Allocated Jobs',
type: 'group',
visible: false
},
completed: {
name: 'Completed Jobs',
type: 'group',
visible: false
},

I can select either of them in the Layer Controller and they display correctly, however even if the overlay is visible on screen; $scope.layers.overlays.jobs.visible is always false.

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

Confusion around tileLayerOptions and layerOptions

From @facultymatt on February 6, 2015 18:56

The use cases for tileLayerOptions and layerOptions are unclear in the examples and documentation.

For example here:

https://github.com/tombatossals/angular-leaflet-directive/blob/9cc9fd1426161b496dfc1e385c3255077c966986/examples/custom-parameters-example.html#L20-L24

and here:

https://github.com/tombatossals/angular-leaflet-directive/blob/dab1c1e1b7d0ea3c8fab6d5d94096e5ed4d6aaed/test/unit/leafletDirectiveSpec.js#L100-L103

However in practice I have found that to get detectRetina to work, you need to put it inside layerOptions and not tileLayerOptions as suggested.

The two above links should be corrected, or the documentation clarified to remove confusion here.

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

Fix readme

Remove references that should not be to tombatossals/angular-leaflet-directive/ for travis and ETC. But do leaf recognition for original idea / fork.

Failed to load resource (file://...) for map tile on mobile device

From @mbmerrill on January 14, 2015 2:40

I'm writing a mobile application using the Ionic framework and Leaflet.

If I use "base" Leaflet, I get my map on both the desktop browser (dev env) and on my mobile device when I deploy to it.

If I use this directive, I get my map on the desktop browser, but when I deploy to my mobile device I get (for example) "Failed to load resource file://a.tile.openstreetmap.org/1/0/0.png"

So it seems to me this indicates that somehow this directive is telling Leaflet to look for a local file instead of grabbing it from the openstreetmap site.

That's a useful feature (and one I will be using eventually), but I need to be able to fetch from the openstreetmap site too! I tried setting the tiles.url in my angular.extend statement explicitly, which did not change the behavior.

What am I missing?

Thanks for your time.

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

Markers and Zoom in / Out buttons don't work on Cordova/Phonegap

From @doronsever on March 22, 2014 18:42

I've successfully placed the angular-leafet-directive in my phonegap(3.4) application.
Everything works great, but, i have few markers on my map with some message on each of them. The first maker, which i put it as focus:true is indeed showing the message, but i cannot see the other messages when i click on the other markers. Nor use the zoom in/out buttons.

Everything works great on my desktop browser

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.