[Geomoose-users] GeoMoose 3 - AGS Legend Support

Brent Fraser bfraser at GeoAnalytic.com
Fri Jun 12 16:36:04 PDT 2020


This works for me (v3.6.2-beta:
 )
     <map-source name="ags-vector-polygons"    type="ags-vector">
        
<url>https://gis2.co.dakota.mn.us/arcgis/rest/services/DCGIS_OL_Transportati
on/MapServer/21</url>
        <layer name="runways" selectable="true" title="Runways">
            <style><![CDATA[
            {
                "line-color" : "red",
                "line-width" : 2,
                "fill-color": "#FF4500",
                "fill-opacity": 0.20
            }
            ]]></style>
            <legend type="html"><![CDATA[
            <div style='padding-top: 3px; padding-bottom: 5px;'>
                <div style='vertical-align: middle; display: inline-block; 
width: 2em; height: 1em;   background-color: rgb(255, 69, 0, 0.2); border: 
solid 2px red;'></div>
                <b>Runways</b>
            </div>
            ]]></legend>
  
  
  
 -------- Original Message --------
> From: "Christopher Hughes" <chughes at co.lincoln.or.us>
> Sent: June 12, 2020 5:10 PM
> To: "GeoMoose Users" <geomoose-users at lists.osgeo.org>
> Subject: Re: [Geomoose-users] GeoMoose 3 - AGS Legend Support
>
> Thanks for all the feedback!
>
> HTML legends look like they may be a viable option that I need to 
explore
> more.
>
> There may be a bug/oversight as I haven't been able to get the legend
> working for the demo's ags-vector layer
> that has its style declared in the map-source (or perhaps the map-source
> needs to be configured in a certain way
> for the legend to show).
>
> Best Regards,
>
> Chris
>
> On Fri, Jun 12, 2020 at 1:44 PM Jim Klassen <klassen.js at gmail.com> 
wrote:
>
> > I think your use of static/dynamic is fine.
> >
> > My point is, with a little creativity, there is a lot of potential 
power
> > in the 'static' legends beyond what is shown in the demo. And it might 
be
> > worth documenting that to get people thinking about what they could do 
with
> > it.
> >
> > I'm be happy for the Apache trick to land in the docs. I've been using
> > MapServer that way for ~15 years. Only reason it isn't in the docs 
already
> > is when I first came up with it, I was told it was too complicated, so 
I
> > dropped it.
> >
> > On 6/12/20 3:15 PM, Brent Fraser wrote:
> > > See comments below
> > >
> > >
> > >
> > > -------- Original Message --------
> > >> From: "Jim Klassen" <klassen.js at gmail.com>
> > >> Sent: June 12, 2020 1:50 PM
> > >> To: bfraser at GeoAnalytic.com, geomoose-users at lists.osgeo.org
> > >> Subject: Re: [Geomoose-users] GeoMoose 3 - AGS Legend Support
> > >>
> > >> I think you are basically correct. A couple of minor points:
> > >>
> > >> Keep in mind that the legend graphic file could be any URL that 
returns
> > > an image and doesn't necessarily need to point to a static file on 
the
> > web
> > > server. So, for example, it could be a legend or preview imaged
> > generated
> > > from a WMS request (or other URL). However, I suspect that you are
> > correct
> > > that it will be 'static' as in it will only be loaded once per 
GeoMoose
> > > session rather than updated as the map view changes.
> > >> Also, an HTML legend can be all sorts of creative with what is 
included
> > > (<a>, CSS background-image: url(...), etc.).
> > >
> > > Yeah, static isn't a very good term, but I was trying to illustrate
> > that
> > > the legend will not change on a pan/zoom as it could with
> > type="mapserver"
> > > or "wms" if there a zoom sensitive layers set up on the data server.
> > >
> > >
> > >> The layer types 'mapserver' and 'mapserver-wfs' are just shortcuts 
for
> > > 'wms' and 'wfs' where GeoMoose does the
> > url='/cgi-bin/mapserv?map=<file>&'
> > > substitution for you (using the values from config.js). (Long ago, 
the
> > > 'mapserver' layer type actually made a Mapserver 'mode=map' request, 
but
> > it
> > > has been using WMS behind the scenes since at least GeoMoose 2.6.)
> > >
> > > Yes, and the move to standard protocols (like wms, wfs) is a good
> > thing.
> > > In fact to test wfs I just created a mapsource like so:
> > >
> > > <map-source name="wfs-polygons" type="wfs" >
> > > <url>http://localhost/cgi-bin/mapserv.exe</url>
> > > <param name="map"
> > > value="C:/ms4w/apps/gm3-demo-data/demo/parcels/parcels.map"/>
> > > <param name="typename" value="ms:parcels"/>
> > > <layer name="default" title="wfs Polygons">
> > >
> > > But there may have been some problems with some Mapserver versions 
in
> > the
> > > past (search the GM source for "wgs84Hack")
> > >
> > >>
> > >> Rant/aside/tangent:
> > >>
> > >> Personally, I don't like the mapserver layer types and think that 
this
> > > path rewrite stuff is better done on the web server so access is
> > consistent
> > > with other WxS clients (like QGIS).
> > >> I have Apache setup with Actions and RewriteRules so that
> > > '/datasets/some.map' -> '/cgi-bin/mapserv' with the MS_MAPFILE
> > environment
> > > variable set to '/srv/datasets/some.map' behind the scenes.
> > >> This also allows for using Apache to manage access to individual
> > mapfiles
> > > as well as separates mapfiles in the logs because every request 
isn't
> > just
> > > /cgi-bin/mapserv with the actual mapfile being potentially hidden in 
a
> > > POST. This also uses Apache to be sure the .map file exists and is 
under
> > > the /srv/datasets tree before executing the request (so things like 
'..'
> > in
> > > the path don't let people tell mapserver to access other places on 
your
> > > server).
> > >> This does require a patch to mapserver or the setting the
> > > "ows_onlineresource" metadata in every mapfile so the links in
> > > GetCapabilites responses point to the right spot.
> > >>
> > >> Something like:
> > >>
> > >> <Directory "/usr/lib/cgi-bin">
> > >> AllowOverride None
> > >> Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
> > >>
> > >> # Only allow specified CGI-BIN files
> > >> Require all denied
> > >>
> > >> # Mapserver
> > >> <Files "mapserv">
> > >> Require all granted
> > >>
> > >> SetEnv MS_ERRORFILE "stderr"
> > >> SetEnv MS_MAP_NO_PATH "true"
> > >>
> > >> RewriteEngine on
> > >> RewriteCond %{env:REDIRECT_HANDLER} ^mapserver
> > >> RewriteCond %{PATH_INFO} ^/datasets/(.*)
> > >> RewriteRule .* -
> > > [C,env=MS_MAPFILE:/srv/datasets/%1]
> > >> RewriteRule .* - [L]
> > >>
> > >> RewriteRule .* - [F]
> > >> </Files>
> > >> </Directory>
> > >>
> > >> <Directory "/srv/datasets/">
> > >> Require all denied
> > >>
> > >> Action mapserver /cgi-bin/mapserv
> > >> AddHandler mapserver .map
> > >> <Files "*.map">
> > >> Require all granted
> > >> </Files>
> > >> </Directory>
> > >> Alias /datasets/ /srv/datasets/
> > >>
> > > Ooo! Nice! How about finding a spot in the docs for that?
> > >
> > >
> > >
> >
> > _______________________________________________
> > Geomoose-users mailing list
> > Geomoose-users at lists.osgeo.org
> > https://lists.osgeo.org/mailman/listinfo/geomoose-users
>
>
>
> --
> Chris Hughes
>
> GIS Analyst
> Lincoln County Surveyor Department
> 880 NE 7th St. l Newport, OR 97365
> Tel: (541) 574 1283
> _______________________________________________ Geomoose-users mailing 
list Geomoose-users at lists.osgeo.org 
https://lists.osgeo.org/mailman/listinfo/geomoose-users




More information about the Geomoose-users mailing list