Skip to content

WFS problems  #103

@Troelshjarne

Description

@Troelshjarne

Im trying to show Point features from a WFS :

https://api.dataforsyningen.dk/forvaltning2?token=9ca510be3c4eca89b1333cadbaa60c36&servicename=forvaltning2&SERVICE=WFS&REQUEST=Getfeature&VERSION=1.1.0&TYPENAMES=forvaltning:togstation&TYPENAME=forvaltning:togstation&STARTINDEX=0&COUNT=100000&SRSNAME=urn:ogc:def:crs:EPSG::25832

ERROR

But im getting this error - TypeError: undefined is not an object (evaluating 'featureInfo.attributes.targetNamespace.value')

Response

In the console I can see that the Response is 200 (ok)
Screenshot 2021-07-07 at 12 33 03

WFS Layer

var togstationer = new L.WFS({
        url:'https://api.dataforsyningen.dk/forvaltning2?token='+kftoken+'&servicename=forvaltning2&SERVICE=WFS&REQUEST=Getfeature&VERSION=1.1.0&TYPENAMES=forvaltning:togstation&TYPENAME=forvaltning:togstation&STARTINDEX=0&COUNT=100000&SRSNAME=urn:ogc:def:crs:EPSG::25832',
        geometryField: 'gml:Point',
        style: {
        "color": "#ff7800",
        "weight": 5,
        "opacity": 1
        },
        
        

    }).addTo(map);

The entire code :

(function() {
    
    // Set Kortforsyningen token, replace with your own token
    var kftoken = '9ca510be3c4eca89b1333cadbaa60c36';
    
    // Set the attribution (the copyright statement shown in the lower right corner)
    // We do this as we want the same attributions for all layers
    var myAttributionText = '&copy; <a target="_blank" href="https://download.kortforsyningen.dk/content/vilk%C3%A5r-og-betingelser">Styrelsen for Dataforsyning og Effektivisering</a>';
 
 
    // Make custom projection using proj4 and proj4leaflet
    var crs = new L.Proj.CRS('EPSG:25832',
	'+proj=utm +zone=32 +ellps=GRS80 +units=m +no_defs', {
        resolutions: [1638.4,819.2,409.6,204.8,102.4,51.2,25.6,12.8,6.4,3.2,1.6,0.8,0.4,0.2,0.1]
    });

    // Make the map object using the custom projection
    var map = new L.Map('map', {
        crs: crs,
        center: [55.709155, 11.459081], // Set center location
        zoom: 9, // Set zoom level,
    });

    // Define layers
    // Skærmkort [WMTS:topo_skaermkort]
    var ortofoto = L.tileLayer.wms('https://services.kortforsyningen.dk/orto_foraar', {
        layers: 'orto_foraar',
        token: kftoken,
        format: 'image/jpeg',
        attribution: myAttributionText
    });
    
    // Skærmkort [WMTS:topo_skaermkort]
    var topo = L.tileLayer.wms('https://services.kortforsyningen.dk/topo_skaermkort', {
        layers: 'dtk_skaermkort',
        token: kftoken,
        format: 'image/png',
        attribution: myAttributionText
    }).addTo(map);
   
    
  
    var togstationer = new L.WFS({
        url:'https://api.dataforsyningen.dk/forvaltning2?token='+kftoken+'&servicename=forvaltning2&SERVICE=WFS&REQUEST=Getfeature&VERSION=1.1.0&TYPENAMES=forvaltning:togstation&TYPENAME=forvaltning:togstation&STARTINDEX=0&COUNT=100000&SRSNAME=urn:ogc:def:crs:EPSG::25832',
        geometryField: 'gml:Point',
        style: {
        "color": "#ff7800",
        "weight": 5,
        "opacity": 1
        },
        
        

    }).addTo(map);
    

   // var filter = new L.Filter.BBox('ogr_geometry', L.latLngBounds(L.latLng(40.712, -74.227), L.latLng(40.774, -74.125)), crs);
    //filter.toGml();

    
   


    // Hillshade overlay [WMS:dhm]
    var hillshade = L.tileLayer.wms('https://services.kortforsyningen.dk/dhm', {
        transparent: true,
        layers: 'dhm_terraen_skyggekort_transparent_overdrevet',
        token: kftoken,
        format: 'image/png',
        attribution: myAttributionText,
        continuousWorld: true,
    });

    // Define layer groups for layer control
    var baseLayers = {
        "Ortofoto": ortofoto,
        "Skærmkort": topo
    };
    var overlays = {
        "togstationer" : togstationer,
        "Hillshade": hillshade
    };

    // Add layer control to map
    L.control.layers(baseLayers, overlays).addTo(map);    

    // Add scale line to map
    L.control.scale({imperial: false}).addTo(map); // disable feet units

})();    

thank you in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions