This opens just fine in the browser and the server seems to respond positively to the WFS request.. but nothing loads. Can someone help me out here?

<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<meta http-equiv="Access-Control-Allow-Origin" content="*">
<div id="map" style="width: 1000px; height: 700px"></div>
var map = L.map('map').setView([64.10418, -20.62987],7);

var owsrootUrl = '';

var defaultParameters = {
    service : 'WFS',
    version : '1.0',
    request : 'GetFeature',
    typeName : 'geonode:Isleif2015-1>',
    outputFormat : 'text/javascript',
    format_options : 'callback:getJson',
    SrsName : 'EPSG:3057'

var parameters = L.Util.extend(defaultParameters);
var URL = owsrootUrl + L.Util.getParamString(parameters);

var WFSLayer = null;
var ajax = $.ajax({
    url : URL,
    dataType : 'jsonp',
    jsonpCallback : 'getJson',
    success : function (response) {
        WFSLayer = L.geoJson(response, {
            style: function (feature) {
                return {
                    stroke: true,
                    fillColor: '#FF0000',
                    fillOpacity: 0
            onEachFeature: function (feature, layer) {
                popupOptions = {maxWidth: 200};
                layer.bindPopup("Popup text, access attributes with feature.properties.ATTRIBUTE_NAME"

var mywms = L.tileLayer.wms("http://gis.lmi.is/geoserver/LMI_raster/wms", {
    layers: 'LMI_raster:atlas',
    format: 'image/png',
    transparent: true,
    version: '1.1.0',
    attribution: "<a href='http://gatt.lmi.is'>LMI</a>"

var overlays = {
    "Isleif2015-1": points,

var layerControl = L.control.layers(null, overlays);

  • 2
    Have you checked the syntax of your URL? In the browser console, I see: Uncaught SyntaxError: Unexpected token <, and trying to access the URL directly, I get the service exception Feature type geonode:Isleif2015-1> unknown. I'm able to see the re-projected Iceland tiles (the LMI raster) on the map, but it looks like the WFS ajax request is failing. – nathansnider Oct 20 '15 at 19:53

If you have a look at the GetCapabilities-Response of your Geoserver you will recognize that there is no layer listet. So either you have no layers published or you don't advertise them to the Capabilities-document and the Layer-Preview:

So it's hard to say if this layer "geonode:Isleif2015-1>" really exists. As in your other question (WFS request works in Geoserver but server returns error) here also seems to be an unneccessary character ">" in the layername.

Having a look at the Geoserver instance of your other question I saw that there exists a Layer "Isleif2015-1", so perhaps you mixed up your Geoservers?

This one works:

var owsrootUrl = '';

var defaultParameters = {
    service : 'WFS',
    version : '1.0',
    request : 'GetFeature',
    typeName : 'Survey:Isleif2015-1',
    outputFormat : 'text/javascript',
    format_options : 'callback:getJson',
    SrsName : 'EPSG:4326',
    MaxFeatures: 200


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.