@@ -7,7 +7,7 @@ var L = require("leaflet");
77$ ( function ( ) {
88
99 // map things
10- var map , fishfryLayer ;
10+ var map , fishfryLayer , refMunis , refChurches
1111 // table things
1212 var fishfryTable ;
1313 // map-to-table things
@@ -21,17 +21,57 @@ $(function () {
2121 zoom : 10
2222 } ) ;
2323
24+ var layerControl = L . control . layers ( { } , { } , { position : "bottomleft" } ) . addTo ( map ) ;
25+
2426 L . tileLayer (
2527 "https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png" , {
2628 maxZoom : 18 ,
2729 attribution : 'Tiles via <a href="http://carto.com">Carto</a>. Basemap data from <a href="http://openstreetmap.org">OpenStreetMap</a>, under <a href="http://creativecommons.org/licenses/by-sa/3.0">CC BY SA</a> license.'
2830 }
2931 ) . addTo ( map ) ;
3032
31- // $.getJSON("http://services1.arcgis.com/jOy9iZUXBy03ojXb/arcgis/rest/services/PennDOTBoundaries_v_2/FeatureServer/2/query?where=1%3D1&f=pgeojson&outSR=4326", (data) => {
32- // console.log("get")
33- // refMunis = L.geoJSON(data, {}).addTo(map);
34- // })
33+ $ . getJSON ( "https://services1.arcgis.com/vdNDkVykv9vEWFX4/ArcGIS/rest/services/Catholic_Churches_in_Allegheny_County/FeatureServer/0/query?where=1%3D1&outFields=name%2Curl%2Cphone_number%2Cemail&returnGeometry=true&outSR=4326&f=pgeojson" , ( data ) => {
34+ refChurches = L . geoJSON ( data , {
35+ pointToLayer : function ( pt , latlng ) {
36+ return L . circleMarker ( latlng , {
37+ radius : 3 ,
38+ weight : 1 ,
39+ color : "#666"
40+ } ) . bindPopup (
41+ L . Util . template (
42+ "<h5>{0}</h5><p><a href='{1}' target='_blank'>website→</a></p><p>email: {2}<br>phone: {3}</p>" , {
43+ 0 : pt . properties . name ,
44+ 1 : pt . properties . url ,
45+ 2 : pt . properties . email ,
46+ 3 : pt . properties . phone_number
47+ }
48+ )
49+ ) ;
50+ }
51+
52+ } ) . setZIndex ( 350 ) . addTo ( map ) ;
53+ // refChurches.setZIndex(350);
54+ layerControl . addOverlay ( refChurches , "Churches" ) ;
55+ } )
56+
57+ $ . getJSON ( "https://opendata.arcgis.com/datasets/9de0e9c07af04e638dbc9cb9070962c2_0.geojson" , ( data ) => {
58+ refMunis = L . geoJSON ( data , {
59+ style : function ( feature ) {
60+ return {
61+ weight : 1.5 ,
62+ color : '#777777' ,
63+ opacity : 0.4 ,
64+ fillColor : '#777777' ,
65+ fillOpacity : 0.1
66+ } ;
67+ } ,
68+ onEachFeature : function ( ft , lyr ) {
69+ lyr . bindPopup ( "<em class='small'>" + ft . properties . LABEL + "</em>" , { opacity : 0.8 } )
70+ }
71+ } ) . setZIndex ( 250 ) . addTo ( map ) ;
72+ layerControl . addOverlay ( refMunis , "Municipalities" ) ;
73+ } )
74+
3575
3676
3777 /** -----------------------------------------
@@ -66,11 +106,13 @@ $(function () {
66106 return L . circleMarker ( latlng , { } ) ;
67107 } ,
68108 onEachFeature : function ( feature , layer ) {
109+ // some vars
69110 var p = feature . properties ;
70111 var edit_link = Flask . url_for ( "load_fishfry" , {
71112 ffid : feature . id
72113 } ) ;
73- //
114+
115+ // POPUP
74116 if ( p . website ) {
75117 layer . bindPopup (
76118 L . Util . template (
@@ -97,11 +139,19 @@ $(function () {
97139 )
98140 ) ;
99141 }
142+ // TOOLTIP
143+ layer . bindTooltip ( p . venue_name , { opacity : 1 } )
144+
100145 }
101146 } ) . addTo ( map ) ;
102147
103148 map . on ( "popupclose" , ( ) => onPopupClose ( ) ) ;
104149
150+
151+ fishfryLayer . bringToFront ( ) ;
152+ refChurches . bringToBack ( ) ;
153+ refMunis . bringToBack ( ) ;
154+
105155 // --------------------------------------
106156 // Leaflet ID to FFID lookup, used for map-table interactivity
107157
@@ -205,4 +255,5 @@ $(function () {
205255 map . closePopup ( ) ;
206256 }
207257
208- } ) ;
258+ } ) ;
259+
0 commit comments