[GeoMoose-users] WFS identify is GeoMoose using MapServer

Jim Klassen klassen.js at gmail.com
Mon Jan 9 10:23:36 PST 2023


I setup https://demo.geomoose.org/3.x/gm3-demo-data/ according to my 
preference for running MapServer.

So the following should work:

<map-source name="wfs-polygons" type="wfs" title="Parcel Polygons">
         
<url>https://demo.geomoose.org/3.x/gm3-demo-data/demo/parcels/parcels.map?</url>
         ...
     </map-source>


And the GetCapabilities is:

https://demo.geomoose.org/3.x/gm3-demo-data/demo/parcels/parcels.map?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetCapabilities 
<https://demo.geomoose.org/3.x/gm3-demo-data/demo/parcels/parcels.map?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetCapabilities>

Apache Setup (on Linux) to make this happen:

ScriptAlias/cgi-bin/ /usr/lib/cgi-bin/
<Directory"/usr/lib/cgi-bin">
AllowOverrideNone
Options+ExecCGI-MultiViews+SymLinksIfOwnerMatch
Requirealldenied
HeadersetAccess-Control-Allow-Origin "*"


                # For Action mapserver /gm3-demo-data/.../XX.map mode
<Files"mapserv">
Requireallgranted

SetEnvMS_MAP_NO_PATH "true"

RewriteEngineon
RewriteCond%{env:REDIRECT_HANDLER} ^mapserver
RewriteCond%{PATH_INFO} ^/3.x/gm3-demo-data/(.*)
RewriteRule.* - [C,env=MS_MAPFILE:/srv/demo/src/3.0/gm3-demo-data-2/%1]
RewriteRule.* - [L]

RewriteRule.* - [F]
</Files>
</Directory>


<Directory"/srv/demo/src/3.0/gm3-demo-data-2">
Requirealldenied

Actionmapserver /cgi-bin/mapserv
AddHandlermapserver .map
<Files"*.map">
Requireallgranted
</Files>
</Directory>
Alias/3.x/gm3-demo-data/ /srv/demo/src/3.0/gm3-demo-data-2/



The gotcha with this setup is when running an unpatched mapserver [1], 
the user visible URL to the mapfile needs to be set in every mapfile, 
which is extremely annoying and error prone.  With the patch, mapserver 
will pickup the user visible URL directly from Apache.

MAP
     METADATA
         'ows_onlineresource' 
'https://demo.geomoose.org/3.x/gm3-demo-data/demo/parcels/parcels.map?'
     END
END

[1] 
https://github.com/klassenjs/mapserver/commit/2d69a4bd27e668fa5e8fad6b43d3f81e3e1dea56




On 1/4/23 10:21, Brent Fraser wrote:
> Hi Jim,
>
>   In my efforts to add WFS mapsources to our mapbook-test-servers.xml, 
> I see that previously I had used
>
>   <map-source name="wfs-polygons" type="wfs"     title="Parcel Polygons">
> <url>http://localhost/cgi-bin/mapserv.exe</url>
>         <param name="map" 
> value="C:/ms4w/apps/gm3-demo-data/demo/parcels/parcels.map"/>
>
> which is not very "robust" for testing.  It's in our demo at 
> demo.geomoose.org <//demo.geomoose.org> and will not work for most 
> people experimenting with
> https://demo.geomoose.org/3.x/desktop/?mapbook=test
>
> I'd like to change the mapbook-test-servers.xml  to use WFS at 
> demo.geomoose.org <https://demo.geomoose.org>  for parcel polygons, 
> points and pipelines.  I guess I would rather not include a map param 
> for each.  How much work do you think it would be to have the map 
> files handled by the server for our demo?
>
> Thanks!
> Brent
>
>
> ------------------------------------------------------------------------
> *From*: "Jim Klassen" <klassen.js at gmail.com>
> *Sent*: 1/3/23 10:51 AM
> *To*: geomoose-users at lists.osgeo.org
> *Subject*: Re: [GeoMoose-users] WFS identify is GeoMoose using MapServer
>
> I would guess that it is non-compliant to send/ask for a SRS that 
> isn't advertised in the GetCapabilities.  I think the bug is that 
> MapServer is working at all.
>
>
>
> Personally, I think type="wfs" should be strongly preferred and 
> type="mapserver-wfs" is the hack.  It is a work around for 
> `/cgi-bin/mapserv?map=/file/system/path&` being ugly.  "mapserver-wfs" 
> really isn't designed to work across multiple mapserver sites either. 
>  IMO MapServer shouldn't be exposing (full) filesystem paths to the 
> web request at all and MapServer 7/8 have been making steps to avoid 
> this more.  If it were up to me, I'd remove the "mapserver-*" types 
> entirely.  I'd expect MS_MAPFILE_PATTERN is already set on the server 
> correctly, otherwise it wouldn't work at all.
>
>
> I'm still partial to adding an Apache handler for ".map" so mapfiles 
> are "run" from within the webroot like a CGI or PHP file would 
> normally be run, but instead of Apache passing it to PHP or 
> Perl/Python/whatever for handling, the mapfile gets passed to 
> MapServer (via environment variables) to run.  A side benefit is 
> Apache sees the path to the mapfile and normal Apache 
> authentication/authorization can be applied within the standard 
> <Directory> or <Location> stanzas.  I don't see any reason to want 
> MapServer to implement yet another authentication/authorization system 
> when Apache is already there.  This works well at least from MapServer 
> 5-7. I haven't tried it with 8 yet.  The catch is that MapServer 
> doesn't auto detect the server URL correctly when doing this so 
> "ows_onlineresource" needs to be set to the URL (as seen by end users) 
> to the mapfile.  (I have a patch for MapServer that lets the 
> auto-detection still work by looking at the SCRIPT_URI environment 
> variable.)
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geomoose-users/attachments/20230109/653af650/attachment.htm>


More information about the GeoMoose-users mailing list