Last active
November 1, 2019 12:05
-
-
Save iamtekson/f8be2d75e308081aef86ca151a347d5b to your computer and use it in GitHub Desktop.
Revisions
-
iamtekson revised this gist
Nov 1, 2019 . 1 changed file with 2 additions and 35 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,25 +1,3 @@ //Geoserver Web Feature Service $.ajax('http://localhost:8080/geoserver/wfs',{ type: 'GET', @@ -28,7 +6,6 @@ version: '1.1.0', request: 'GetFeature', typename: 'workspace:layer_name', srsname: 'EPSG:4326', outputFormat: 'text/javascript', }, @@ -37,18 +14,8 @@ jsonp:'format_options' }); // the ajax callback function function handleJson(data) { selectedArea = L.geoJson(data).addTo(map); map.fitBounds(selectedArea.getBounds()); } -
iamtekson revised this gist
Nov 1, 2019 . 1 changed file with 0 additions and 21 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,21 +0,0 @@ -
iamtekson revised this gist
Nov 1, 2019 . 2 changed files with 55 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,54 @@ <html> <head> <link rel="stylesheet" href="https://unpkg.com/leaflet@1.5.1/dist/leaflet.css"> <style> #map { width: 100%; height: 500px; } </style> </head> <body> <div id="map"></div> <script src="https://unpkg.com/leaflet@1.5.1/dist/leaflet.js"></script> </body> </html> <script> var map = L.map("map").setView([38.45, 70.6], 6); var osm = L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", { attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' }).addTo(map); //Geoserver Web Feature Service $.ajax('http://localhost:8080/geoserver/wfs',{ type: 'GET', data: { service: 'WFS', version: '1.1.0', request: 'GetFeature', typename: 'workspace:layer_name', CQL_FILTER: "column='demo'", srsname: 'EPSG:4326', outputFormat: 'text/javascript', }, dataType: 'jsonp', jsonpCallback:'callback:handleJson', jsonp:'format_options' }); //Geojson style file var myStyle = { 'color': 'red' } // the ajax callback function function handleJson(data) { selectedArea = L.geoJson(data, { style: myStyle, onEachFeature: function(feature, layer) { layer.bindPopup(`Name: ${feature.properties.name_of_your_property}`) } }).addTo(map); map.fitBounds(selectedArea.getBounds()); } </script> This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -16,11 +16,6 @@ $.ajax('http://localhost:8080/geoserver/wfs',{ // the ajax callback function function handleJson(data) { selectedArea = L.geoJson(data).addTo(map); map.fitBounds(selectedArea.getBounds()); } -
iamtekson revised this gist
Nov 1, 2019 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,8 +5,7 @@ $.ajax('http://localhost:8080/geoserver/wfs',{ service: 'WFS', version: '1.1.0', request: 'GetFeature', typename: 'workspace:layer_name', srsname: 'EPSG:4326', outputFormat: 'text/javascript', }, -
iamtekson created this gist
Nov 1, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ //Geoserver Web Feature Service $.ajax('http://localhost:8080/geoserver/wfs',{ type: 'GET', data: { service: 'WFS', version: '1.1.0', request: 'GetFeature', typename: 'tajikistan:country', CQL_FILTER: `standard_n='${value}'`, srsname: 'EPSG:4326', outputFormat: 'text/javascript', }, dataType: 'jsonp', jsonpCallback:'callback:handleJson', jsonp:'format_options' }); // the ajax callback function function handleJson(data) { selectedArea = L.geoJson(data, { style: geoJsonStyle, onEachFeature: function(feature, layer) { layer.bindPopup(`Name: ${feature.properties.standard_n}`) } }).addTo(map); map.fitBounds(selectedArea.getBounds()); }