GeoServer web.xml
<context-param>
<param-name>ENABLE_JSONP</param-name>
<param-value>true</param-value>
</context-param>
Request WFS
var wfsParams = {
service: 'WFS',
version: '1.1.0',
request: 'GetFeature',
typeName: 'vizm:tl_scco_sig',
maxFeatures: '50',
srsName: 'EPSG:4326',
outputFormat: 'text/javascript',
format_options: 'callback:responseJSON'
};
$.ajax({
url: 'http://localhost:8081/geoserver/vizm/wfs',
data: $.param(wfsParams),
type: 'GET',
jsonpCallback: 'responseJSON',
dataType:'jsonp',
success: function(data) {
console.log(data);
L.geoJson(data, {
onEachFeature: function(feature, layer) {
var popupContent = "</p>" + feature.geometry.type + "</p>";
if (feature.properties && feature.properties.sig_kor_nm) {
popupContent += feature.properties.sig_kor_nm + '(' + feature.properties.sig_eng_nm + ')';
}
layer.bindPopup(popupContent);
}
}).addTo(map);
}, error: function(xhr, status, thrown) {
console.log(status);
}
});
Reference
- http://gis.stackexchange.com/questions/70990/request-wfs-from-geoserver-with-jquery-ajax-using-intersect-cql-filter-error
- http://gis.stackexchange.com/questions/34892/how-to-get-json-from-geoserver-using-ajax-request
- http://gis.stackexchange.com/questions/27468/how-do-i-get-geojson-data-from-geoserver-into-show-up-on-my-leaflet-map
'Dev Story > gis' 카테고리의 다른 글
[GeoServer] Log4j 2 취약점 코드 CVE-2021-44228 (0) | 2021.12.23 |
---|---|
[OpenLayers] Errors #58 (0) | 2021.12.23 |
[geoserver] log4j 설정 (0) | 2014.03.14 |
[postgresql] java.io.IOException: Error occurred creating table (0) | 2014.03.12 |
[geoserver] ERROR:ST_Estimated_Extent (0) | 2014.03.10 |