geomoose / gm3

GeoMoose 3.0 Development. Please submit pull requests to the 'main' branch.
https://www.geomoose.org
MIT License
58 stars 60 forks source link

Issue on Add highlight in WFS layer #849

Closed blackdata1 closed 9 months ago

blackdata1 commented 9 months ago

Hello everybody! I need your valuable support, I'm starting with super Geomoose. My mapbook is: `

    <param name="REQUEST" value="GetFeature"/>
    <param name="SERVICE" value="WFS"/>
    <param name="VERSION" value="2.0.0"/>
    <param name="OUTPUTFORMAT" value="application/gml+xml"/>
    <param name="TRANSPARENT" value="true"/>
    <param name="LAYERS" value="limite_colonias_wfs"/>
    <param name="TYPENAME" value="ms:limite_colonias_wfs"/>
    <param name="SRSNAME" value="EPSG:32614"/>
    <file>./data/colonias/limite_colonias_wfs.map</file>      
    <layer name="limite_colonias_wfs" selectable="true" >
        <template name="identify" auto="true" />
    </layer>
</map-source>`

`

./data/colonias/limite_colonias_wfs.map
    <layer name="limite_colonias" query-as="coloniaswfs/limite_colonias_wfs" />
    <param name="FORMAT" value="image/png"/>
    <layer name="all"/>
</map-source>`

<layer src="limitecolonias/limite_colonias"/>

My layer.map is work succesfully, i try mount on QGIS and the layer is work, on Geomoose the layer visible but when i try use identify service, i get this message on console: TypeError: Cannot read properties of undefined (reading 'split') at Dd (geomoose.min.js:2:1056411) at rM.wfsGetFeatureQuery (geomoose.min.js:2:1518903) at rM.runQuery (geomoose.min.js:2:1522214) at rM.checkQueries (geomoose.min.js:2:1522464) at rM.componentDidUpdate (geomoose.min.js:2:1530252) at xl (geomoose.min.js:2:565485) at e.unstable_runWithPriority (geomoose.min.js:2:603440) at Yi (geomoose.min.js:2:510349) at wl (geomoose.min.js:2:561935) at ll (geomoose.min.js:2:552358)

Is there any additional configuration?

brentfraser commented 9 months ago

Which version of GeoMoose are you using? And which version of Mapserver?

blackdata1 commented 9 months ago

Geomoose 3.10.1 Mapserver 7.6.4

brentfraser commented 9 months ago

I think GeoMoose is still limited to using EPSG:4326 for WFS data query and outputFormat. To confirm this you would need to set the map-source's SRSNAME to this, and add 4326 to the Mapserver's wfs_srs list. There could be more config issues too.

If you are comfortable using your browser's Developer Tools you could examine the network conversation between GeoMoose and Mapserver to see what GeoMoose is requesting and the response by Mapserver (e.g is Mapserver generating an error message?).

tchaddad commented 9 months ago

Can you report the epsg code for your layer?

And then, can you check the order of the epsg codes listed in your INCLUDE '../../common_metadata.map'file?

I've found that the projection of the layer being searched needs to be listed first in the list of projections for 'ows_srs' and 'wfs_srs, otherwise the search will return no results. It's possible this also impacts info queries.

blackdata1 commented 9 months ago

This is the conversation Geomoose-MapServer: http://127.0.0.1/cgi-bin/mapserv?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&FORMAT=image%2Fpng&TRANSPARENT=true&LAYERS=limite_colonias&MAP=%2Fvar%2Fwww%2Fhtml%2FMapServerProto%2F.%2Fdata%2Fcolonias%2Flimite_colonias_wfs.map&SRS=EPSG%3A3857&STYLES=&WIDTH=1521&HEIGHT=804&BBOX=-11317787.264839841%2C2406376.954715598%2C-11309230.982999088%2C2410899.8019213616 On Geomoose the layer is displayed correctly, with this new configuration: MapBook.xml `

    <param name="REQUEST" value="GetFeature"/>
    <param name="SERVICE" value="WFS"/>
    <param name="VERSION" value="2.0.0"/>
    <param name="OUTPUTFORMAT" value="application/gml+xml"/>
    <param name="TRANSPARENT" value="true"/>
    <param name="LAYERS" value="limite_colonias_wfs"/>
    <param name="TYPENAME" value="ms:limite_colonias_wfs"/>
    <param name="SRSNAME" value="EPSG:4326"/>
    <file>./data/colonias/limite_colonias_wfs.map</file>      
    <layer name="limite_colonias_wfs" selectable="true" >
        <template name="identify" auto="true" />
    </layer>
</map-source>`

`

./data/colonias/limite_colonias_wfs.map
    <layer name="limite_colonias" query-as="coloniaswfs/limite_colonias_wfs" />
    <param name="FORMAT" value="image/png"/>
    <layer name="all"/>
</map-source>`

<layer src="limitecolonias/limite_colonias"/>

And my mapfile there: `MAP INCLUDE '../../geomoose_globals.map' WEB TEMPLATE "x.html" METADATA 'ows_title' 'Limite de Colonias WFS' INCLUDE '../../common_metadata_sig.map' 'wfs_getfeature_formatlist' 'gml,geojson' "wfs_enable_request" "*" "wfs_getfeature_formatlist" "application/gml+xml" "gml_featureid" "gid" END END

DEBUG 5

LAYER
    NAME limite_colonias
    STATUS ON
    METADATA
        'ows_title' 'Limite Colonias'
        'ows_include_items' 'all'
        'gml_include_items' 'all'
        'wfs_enable_request' '*'
    END
    TYPE POLYGON
    CONNECTIONTYPE POSTGIS
    INCLUDE 'conexion.map'
    DATA "geometry from colonias using unique gid using srid=32614"
    PROJECTION
        'init=epsg:32614'
    END
    LABELCACHE ON
    LABELMAXSCALE 20000
    CLASS
        NAME 'limite_colonias'
        STYLE
            WIDTH 3
            COLOR -1 -1 -1
            OUTLINECOLOR 93 181 53
            MAXSCALEDENOM 15000
        END
        STYLE
            SIZE 1
            COLOR -1 -1 -1
            OUTLINECOLOR 33 106 43
        END
        LABEL
            TYPE TRUETYPE
            FONT vera_sans
            SIZE 8
            ANTIALIAS TRUE
            COLOR 0 0 0
            OUTLINECOLOR 254 254 200
            BUFFER 4
            MINFEATURESIZE auto
            PARTIALS FALSE
            POSITION cc
        END
    END
    TEMPLATE 'dummy'
END

END`

'ows_enable_request' '*' 'ows_srs' 'EPSG:26915 EPSG:4326 EPSG:3857 EPSG:900913 EPSG:32614' 'wfs_srs' 'EPSG:26915 EPSG:4326 EPSG:3857 EPSG:900913 EPSG:32614' 'wms_feature_info_mime_type' 'application/json'

The result on console: the same.

tchaddad commented 9 months ago

From your map file it seems the EPSG code for your data is EPSG:32614

My suggestion is to put this code in the beginning of the list of EPSG codes in the enable_requests:

'ows_enable_request'  '*' 
'ows_srs' 'EPSG:32614 EPSG:26915 EPSG:4326 EPSG:3857 EPSG:900913 ' 
'wfs_srs' 'EPSG:32614 EPSG:26915 EPSG:4326 EPSG:3857 EPSG:900913' 
'wms_feature_info_mime_type' 'application/json'
brentfraser commented 9 months ago

GeoMoose is doing a WMS request and getting a good image from Mapserver, so it looks like your "limitecolonias" map-source is working. If you are planning to use the WFS map-source for Identify, do an Identify on one of the polygons in the image and see what GeoMoose is sending the server and the response. I'm not sure about the <param name="VERSION" value="2.0.0"/> for the WFS protocol; I use1.1.0 in my testing.

blackdata1 commented 9 months ago

I took you suggestion @tchaddad , the layer on .map is correctly work. @brentfraser, rigth now update this param, but in generated conversartion Geomoose-Mapserver this param change to 1.1.0 (I don't understand how, I think it's from Geomoose). The issue on this layer is about the use identify service, i need apply highlight on some selected polygon, but when use this service on the layer broke geomoose and i get this console message: TypeError: Cannot read properties of undefined (reading 'split') at Dd (geomoose.min.js:2:1056411) at rM.wfsGetFeatureQuery (geomoose.min.js:2:1518903) at rM.runQuery (geomoose.min.js:2:1522214) at rM.checkQueries (geomoose.min.js:2:1522464) at rM.componentDidUpdate (geomoose.min.js:2:1530252) at xl (geomoose.min.js:2:565485) at e.unstable_runWithPriority (geomoose.min.js:2:603440) at Yi (geomoose.min.js:2:510349) at wl (geomoose.min.js:2:561935) at ll (geomoose.min.js:2:552358) Something like an experience? Any suggestions?

brentfraser commented 9 months ago

Try this as a WFS map-source:


<map-source name="coloniaswfs" type="mapserver-wfs">
    <config name="pixel-tolerance" value="0"/>
    <param name="typename" value="ms:limite_colonias_wfs"/>
    <file>data/colonias/limite_colonias_wfs.map</file>
    <layer name="limite_colonias_wfs" selectable="true">
        <template name="identify" auto="true"/>
    </layer>
</map-source>```
blackdata1 commented 9 months ago

Great @brentfraser , the configuration on Mapbook.xml: `

    <param name="typename" value="ms:limite_colonias"/>
    <file>./data/colonias/limite_colonias_wfs.map</file>      
    <layer name="limite_colonias_wfs" selectable="true" >
        <template name="identify" auto="true" />
    </layer>
</map-source>`

<layer src="limitecolonias/limite_colonias"/> `

./data/colonias/limite_colonias_wfs.map
    <layer name="limite_colonias" query-as="coloniaswfs/limite_colonias_wfs" />
    <param name="FORMAT" value="image/png"/>
    <layer name="all"/>
</map-source>`

<layer src="limitecolonias/limite_colonias"/>

Now the highlight function in WFS layer is work succesfully. Thank you! Regards since MX.

tchaddad commented 9 months ago

declaring victory, and closing - thanks @brentfraser !