Hi all

I have a problem trying to call a wfs request from geoserver and load it
into a geojson layer in leaflet..

I have a proxy set up so I can load localhost/geoserver  ok and have
enabled jsonp in the web.xml.  When I run the script below it opens my
leaflet map but does not load the layer. There are no error messages in my
console so I'm not sure where I'm going wrong.

Leaflet script:

var map = L.map('map').setView([50.370, -4.14], 14);
 var basemap = L.tileLayer('http://{s}.
tile.cloudmade.com/a8ed148d84c2438ba62c2742cac051ae/33356/256/{z}/{x}/{y}.png',
{
maxZoom: 18,
attribution: '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>'
}).addTo(map);

var myLayer = new L.geoJson().addTo(map);

function loadGeoJson() {myLayer.addGeoJson(data);
}

var geoJsonUrl = "
http://localhost/geoserver/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=dartmoor:Boundary_region&srsName=EPSG:4326&format=text/javascript&outputFormat=json&format_options=callback:loadGeoJson
";

$.ajax({
        url: geoJsonUrl,
datatype:"jsonp"
});


Geoserver log:

2013-06-28 14:49:30,862 INFO [geoserver.wfs] -
Request: getServiceInfo
2013-06-28 14:49:30,864 INFO [geoserver.wfs] -
Request: getFeature
    service = WFS
    version = 1.0.0
    baseUrl = http://localhost:80/geoserver/
    query[0]:
        srsName = EPSG:4326
        typeName[0] = {http://www.dartmoor.gov.uk/}Boundary_region
    outputFormat = json
    resultType = results
    formatOptions = {CALLBACK=loadGeoJson}
2013-06-28 14:49:30,865 INFO [wfs.json] - about to encode JSON
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to