Adding a GitSpatial vector

20 views
Skip to first unread message

Gianni Cristian

unread,
Oct 30, 2013, 9:25:14 AM10/30/13
to leaflet-ve...@googlegroups.com
Dear All, 

I want to add a GitSpatial vector as in the Leaflet Vector Layer example HERE but I could not manage that! Could you please check my code and see where I wrong?


<HTML>
     <HEAD>
         <TITLE> GitSpatial </TITLE>
<link rel="stylesheet" href="src/leaflet.css" />
<link rel="stylesheet" type="text/css" href="src/style.css" />
 <!--[if lte IE 8]>
     <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.ie.css" />
 <![endif]-->
        </head>
     </HEAD>
     <BODY>
          <P> </P>

<div id="map"></div>

                <script src="src/leaflet.js" type="text/javascript"></script>
                <script src="src/jquery-1.8.1.min.js" type="text/javascript"></script>
                <script src="src/lvector.js" type="text/javascript"></script>
                <script src="src/GeoJSONLayer.js" type="text/javascript"></script>
                <script src="src/GitSpatial.js" type="text/javascript"></script>

                <script>
                  window.onload = function () {


            var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/afda1fc8c23548c28eeb256f3e08707c/{styleId}/256/{z}/{x}/{y}.png',
                cloudmadeAttribution = 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://cloudmade.com">CloudMade</a>';
            var cloudmade   = L.tileLayer(cloudmadeUrl, {styleId: 997, attribution: cloudmadeAttribution});


            var map = new L.map('map', {
                center: new L.LatLng(42.3736, -71.1130),
                zoom: 13,
                layers: [cloudmade],
                zoomControl:true
             });



            gitspatial_neighborhoods = new lvector.GitSpatial({
                    user: 'JasonSanford',
                    repo: 'cambridgegis_data',
                    featureSet: 'neighborhoods',
                    showAll: true,
                    symbology: {
                        type: 'single',
                        vectorOptions: {
                            fillColor: '#ff7800',
                            color: '#46461f',
                            weight: 3,
                            opacity: 1
                        }
                    },
                    popupTemplate: '<h3>{NAME}</h3>',
                    singlePopup: true
                });

            gitspatial_neighborhoods.setMap(map);

                    };
                </script>


     </BODY>
</HTML>


Thank You All!!
Gianni
 

Jason Sanford

unread,
Oct 30, 2013, 9:31:13 AM10/30/13
to leaflet-ve...@googlegroups.com
I see you're referencing lvector.js, GeoJSONLayer.js and GitSpatial.js. If you're using the distributed javascript library (found in the /dist directory in the repo), you should only need to add lvector.js as it is comprised of all other necessary JavaScript.


--
You received this message because you are subscribed to the Google Groups "Leaflet Vector Layers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leaflet-vector-l...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Gianni Cristian

unread,
Oct 30, 2013, 9:56:17 AM10/30/13
to leaflet-ve...@googlegroups.com
It Works! I was using the one in the /src directory. That's why didn't work.

Thanks,
Gianni


On Wednesday, October 30, 2013 2:31:13 PM UTC+1, Jason wrote:
I see you're referencing lvector.js, GeoJSONLayer.js and GitSpatial.js. If you're using the distributed javascript library (found in the /dist directory in the repo), you should only need to add lvector.js as it is comprised of all other necessary JavaScript.
Reply all
Reply to author
Forward
0 new messages