JasonSanford / leaflet-vector-layers

A little help to viewing ArcGIS Server, Geocommons, Arc2Earth, CartoDB, GIS Cloud, etc. vector data in a Leaflet map
http://jasonsanford.github.io/leaflet-vector-layers
BSD 2-Clause "Simplified" License
217 stars 61 forks source link

GeoIQ popup not working #41

Open mpjashby opened 11 years ago

mpjashby commented 11 years ago

I can't get popups to work on GeoIQ point features using a {braces} type popupTemplate:

<!DOCTYPE html>
<html lang="en-GB">
    <head>
        <title>Leaflet vector layers test</title>

        <link rel="stylesheet" href="http://leaflet.cloudmade.com/dist/leaflet.css">

        <script src="http://leaflet.cloudmade.com/dist/leaflet.js"></script>
        <script src="http://maps.stamen.com/js/tile.stamen.js?v1.2.0"></script>
        <script src="http://www.crimeinlondon.com/js/vendor/lvector.js"></script>
    </head>
    <body>
        <div id="mainboroughmap" style="height: 600px;"></div>
        <script>
            var railMarker = L.Icon.extend({options: {iconUrl: "http://www.crimeinlondon.com/img/atoc-logo-small.png",shadowUrl: null}});
            var stamen2 = new L.StamenTileLayer("toner-lite");
            var boroughmap = new L.Map("mainboroughmap", {
                    layers: [stamen2],
                    maxZoom: 16,
                    minZoom: 13
                }).setView([51.4863683774,-0.101332641196], 15);

            var railstns = new lvector.GeoIQ({dataset: 315350,map:boroughmap,uniqueField: "atcocode",scaleRange: [13,16],symbology: {type: "single",vectorOptions: {icon: new railMarker()}},popupTemplate:'<p>{commonname}</p>',singlePopup:true});
        </script>
    </body>
</html>

Is this a bug or have I got a mistake in my code?

JasonSanford commented 11 years ago

A quick look turns up nothing. One thing I notice in your code above is that you're linking to the master code at the old Leaflet domain. You should probably use a versioned Leaflet hosted at the CDN:

http://cdn.leafletjs.com/leaflet-0.5.1/leaflet.js

But, even with that change I still get the error. I'll look more into this soon.

snkashis commented 11 years ago

Uncaught TypeError: Cannot read property 'y' of undefined in _updatePosition..hmmm.

shaunakv1 commented 11 years ago

I am getting the same issue with AGS layer. It seems this happens when we use 'icon: new railMarker()' . That is when using a custom icon. Any solutions to this yet?