Skip to content

Instantly share code, notes, and snippets.

@iamtekson
Last active October 30, 2019 17:24
Show Gist options
  • Save iamtekson/c0ee4b1365f0264ea98a1ed6a745f97d to your computer and use it in GitHub Desktop.
Save iamtekson/c0ee4b1365f0264ea98a1ed6a745f97d to your computer and use it in GitHub Desktop.
This is the geoserver WFS.
//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: `name_rg='Centre'`,
srsname: 'EPSG:4326',
outputFormat: 'text/javascript',
},
dataType: 'jsonp',
jsonpCallback:'callback:handleJson',
jsonp:'format_options'
});
function handleJson(data) {
var a = L.geoJson(data).addTo(map);
map.fitBounds(a.getBounds())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment