The geoserver logs don't indicate anything wrong as far as geoserver
receiving the request and responding to it, so your problem is likely in
the JavaScript code.  You should investigate the developer tools for your
browser (chrome and firefox have them built in these days, I think it is a
free download for internet explorer.)  Verify that the browser is receiving
the JSON using the developer tools - if something is wrong with the JSON
(like geometries are missing) then let us know here, otherwise you're
probably better off asking the leaflet team on Twitter or their Google
Group.

--
David Winslow
OpenGeo - http://opengeo.org/


On Fri, Jun 28, 2013 at 10:00 AM, Matt Travis <[email protected]>wrote:

> 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<http://tile.cloudmade.com/a8ed148d84c2438ba62c2742cac051ae/33356/256/%7Bz%7D/%7Bx%7D/%7By%7D.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
>
>
------------------------------------------------------------------------------
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