geomoose / gm3

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

Add source projection information to map-sources #787

Open theduckylittle opened 1 year ago

theduckylittle commented 1 year ago

Add a src-proj property to WFS sources to make configuring the projection information more explicit.

This will work with a WFS in its preferred projection.

klassenjs commented 1 year ago

I'm not sure on this one. I'm getting JS Console errors, but I might be doing it wrong. Is there docs/test case for this?

theduckylittle commented 1 year ago

@klassenjs see #542 for a test case. This latest version should be working properly with both EPSG:3857 layers and EPSG:4326 layers.

brentfraser commented 1 year ago

Display of WFS EPSG:4326 features works! But Identify and Select does not.

GeoMoose/OL sends a GetFeature request with a Filter containing <PropertyName>geom</PropertyName> which must be a default somewhere in the code. My two test servers report a geom name of msGeometry (e.g. see https://demo.mapserver.org/cgi-bin/wfs?SERVICE=WFS&VERSION=1.1.0&REQUEST=DescribeFeatureType )

I think we ran across this problem when implementing WFS-T and added: <config name="geometry-name" value="wkb_geometry" /> to the map-source definition.

Or maybe the problem is the coordinate def / order (such a nightmare for WFS 1.0, 1.1, 2.0).

klassenjs commented 1 year ago

I think this needs a manual merge/rebase. I'm not seeing the vector parcels or pipelines layers on the map anymore (MapServer on the demo server is returning an error).

Note: tested with a local checkout of this branch and then a local git rebase main (which applied cleanly).

<wfs:FeatureCollection xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/WFS-basic.xsd http://mapserver.gis.umn.edu/mapserver https://demo.geomoose.org/cgi-bin/mapserv7?map=/srv/demo/src/3.x/gm3-demo-data/demo/parcels/parcels.map&SERVICE=WFS&VERSION=1.1.0&REQUEST=DescribeFeatureType&TYPENAME=ms:parcels&OUTPUTFORMAT=XMLSCHEMA">
<gml:boundedBy>
<gml:null>missing</gml:null>
</gml:boundedBy>
</wfs:FeatureCollection>
brentfraser commented 1 year ago

Here's my mapbook for testing this PR (AKA Issue #542 ), as well as Issue #772

<?xml version="1.0"?>
<mapbook version="3.0">
    <!-- *********************************************************
        Issues
    *********************************************************  -->

    <map-source name="issue542"                    type="wfs" src-proj="EPSG:4326" title="Issue 542">
        <url>https://mrdata.usgs.gov/wfs/sgmc2</url>
        <param name="cross-origin" value="anonymous"/>
        <param name="typename" value="ms:Structure"/>
        <param name="srsname"  value="EPSG:4326"/>
        <layer name="Structure" >
            <style><![CDATA[
            {
                "circle-radius": 4,
                "circle-color": "#fec44f",
                "fill-color": "#fec44f",
                "circle-stroke-color": "#d95f0e",
                "line-color": "blue",
                "line-width": 2,
                "fill-opacity": 0.20,
                "line-opacity": 0.80,
                "text-field_COMMENTED-OUT": "{OWNER_NAME}",
                "text-color": "#000000"
            }
            ]]></style>
            <template name="identify" auto="true" />
        </layer>
    </map-source>

    <map-source name="issue772"                 type="wfs"   src-proj="EPSG:4326"  title="World Cities">
    <!-- :https://demo.mapserver.org/cgi-bin/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetCapabilities -->
        <url>https://demo.mapserver.org/cgi-bin/wfs?</url>
        <param name="cross-origin" value="anonymous"/>
        <param name="typename" value="ms:cities"/>
        <param name="srsname"  value="EPSG:4326"/>
        <param name="outputFormat" value="GML2"/>  <!-- From GetCapabilities: GML2: "text/xml; subtype=gml/2.1.2; charset=UTF-8" -->

        <config name="pixel-tolerance" value="3" />
        <layer name="cities" title="World Cities">
            <style><![CDATA[
            {
                "circle-radius": 4,
                "circle-color": "#fec44f",
                "fill-color": "#fec44f",
                "circle-stroke-color": "#d95f0e",
                "line-color": "blue",
                "line-width": 2,
                "fill-opacity": 0.20,
                "line-opacity": 0.80,
                "text-field_COMMENTED-OUT": "{OWNER_NAME}",
                "text-color": "#000000"
            }
            ]]></style>
            <template name="identify" auto="true" />
            <template name="select"   auto="true" />
        </layer>
    </map-source>

    <map-source name="wfs"                 type="wfs"   src-proj="EPSG:4326"  title="water_areas">
        <url>https://ahocevar.com/geoserver/wfs?</url>
        <param name="cross-origin" value="anonymous"/>
        <param name="typename" value="osm:water_areas"/>
        <param name="srsname"  value="EPSG:4326"/>
        <param name="outputFormat" value="GML2"/>  <!-- From GetCapabilities: GML2: "text/xml; subtype=gml/2.1.2; charset=UTF-8" -->

        <config name="pixel-tolerance" value="3" />
        <layer name="water_areas" title="water_areas">
            <style><![CDATA[
            {
                "circle-radius": 4,
                "circle-color": "#fec44f",
                "fill-color": "#fec44f",
                "circle-stroke-color": "#d95f0e",
                "line-color": "blue",
                "line-width": 2,
                "fill-opacity": 0.20,
                "line-opacity": 0.80,
                "text-field_COMMENTED-OUT": "{OWNER_NAME}",
                "text-color": "#000000"
            }
            ]]></style>
            <template name="identify" auto="true" />
            <template name="select"   auto="true" />
        </layer>
    </map-source>

    <!-- *********************************************************
        Image Only
    *********************************************************  -->
    <!-- - - - - - - -  TYPE = "xyz"   - - - - - - - - - - - - -->
    <map-source name="openstreetmap"              type="xyz" opacity="0.5">
        <url>https://a.tile.openstreetmap.org/{z}/{x}/{y}.png</url>
        <url>https://b.tile.openstreetmap.org/{z}/{x}/{y}.png</url>
        <url>https://c.tile.openstreetmap.org/{z}/{x}/{y}.png</url>
        <param name="cross-origin" value="anonymous"/>        
        <layer name="osm_mapnik" status="on">
            <attribution><![CDATA[
                    &copy; <a href="http://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> Contributors.
            ]]></attribution>
<!--            <legend type="img">https://c.tile.openstreetmap.org/12/987/1478.png</legend>  -->
            <legend type="html"><![CDATA[
                <img width="100" height="100" src="https://c.tile.openstreetmap.org/12/987/1478.png">
            ]]></legend>
        </layer>
    </map-source>

    <!-- =========================================================
        The catalog defines how the layers will be displayed in the catalog tab.
    =========================================================  -->
    <catalog>
        <group title="Issues"                             expand="true" tip="">
            <layer title=" Allow WFS query return to be in EPSG:4326 #542 " src="issue542/Structure" legend-toggle="false" show-legend="false" legend="false" fade="false" unfade="false"></layer>
            <layer title=" WFS: do not send a MAP= parameter  #772 " src="issue772/cities" legend-toggle="false" show-legend="false" legend="false" fade="false" unfade="false"></layer>
            <layer title=" WFS:OpenLayers Example" src="wfs/water_areas" legend-toggle="false" show-legend="false" legend="false" fade="false" unfade="false"></layer>
        </group>

        <group title="Image Only"                             expand="false" tip="">
            <group title="XYZ Tiles"           expand="true">
                <layer title="OpenStreetmap" src="openstreetmap/osm_mapnik" legend-toggle="true" show-legend="true" legend="true" fade="true" unfade="true">
                </layer>
            </group>
        </group>

    </catalog>

    <toolbar>
        <tool name="fullextent" title="Zoom to Full Extent" type="action"/>
        <tool name="measure"    title="Measure"             type="service"/>
        <tool name="print"      title="Print"               type="action"/>

        <tool name="identify"   title="Identify" type="service"/>
        <tool name="select"     title="Select"   type="service"/>

        <drawer name="searches" title="Search">
            <tool name="geocode"                                title="Geocode an Address"      type="service"/>
        </drawer>

        <tool name="findme"     title="Find Me"    type="action"/>
        <tool name="reload"     title="Start Over" type="action"/>
    </toolbar>
</mapbook>