[Geomoose-users] GeoMoose 3 - AGS Legend Support
Jeff McKenna
jmckenna at gatewaygeomatics.com
Fri Jun 12 13:26:51 PDT 2020
This may also be of some help: a very old demo I created showing
MapServer legends and its code, likely created about 18 years ago by me
no kidding ha: click on the first demo for example (someone recently
asked me to update all of these for MapServer 7 which I did last month):
https://demo.mapserver.org/itasca_legend/ Scroll to the bottom of the
page you can find the mapfile link and the HTML legend code.
HTML legends are still a very powerful part of MapServer. Might be
applicable here, or at least give you another option.
-jeff
--
Jeff McKenna
MapServer Consulting and Training Services
co-founder of FOSS4G
http://gatewaygeo.com/
On 2020-06-12 4:50 p.m., Jim Klassen wrote:
> 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.).
>
>
> 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.)
>
>
> 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/
>
>
>
> On 6/12/20 2:05 PM, Brent Fraser wrote:
>> So much documenting to do...
>> AFAIK, GM3 has two kinds of legends: static and dynamic (my terms)
>> Static you add to the mapbook for vector layers as type="html" (so you
>> code CSS styling in the mapbook), or type="img" and you supply a graphic
>> file.
>> Dynamic is only for map-source types of "mapserver" (and maybe
>> "wms"?) and
>> the legend will be created on the server composed of the rendered
>> features.
>> I think GM only supports image legends, not JSON ,etc.
>> So currently, GM 3 does not support a dynamic (data server-generated)
>> legend for vector data sources.
>> Brent
>> -------- Original Message --------
>>> From: "Jim Klassen" <klassen.js at gmail.com>
>>> Sent: June 12, 2020 12:37 PM
>>> To: geomoose-users at lists.osgeo.org
>>> Subject: Re: [Geomoose-users] GeoMoose 3 - AGS Legend Support
>>>
>>> In GeoMoose, vector layers are styled and rendered in the browser rather
>> than by the server. Thus, I would expect legends for ags-vector to behave
>> the same as any other vector layer. If that isn't currently the case for
>> ags-vector then that is an oversight/bug. On 6/12/20 1:19 PM, Brent
>> Fraser
>> wrote: > Hi Chris, > > I haven't looked into AGS legend yet, but my guess
>> is no, neither > type="ags" or type="ags-vector" support legends. > > A
>> longer answer: > > Both type="ags" and type="ags-vector" are for
>> accessing
>> ArcGIS Servers > with MapServer endpoints (they do not access
>> FeatureServer
>> endpoints) > Responding to Legend requests is an option when setting
>> up the
>> AGS server > (and it looks like most don't?). And AGS servers can serve
>> different > formats of legends >
>> (https://developers.arcgis.com/rest/services-reference/legend-map-service-.h
>>
>> > tm) and different kinds >
>> https://developers.arcgis.com/rest/services-reference/query-legends-map-serv
>>
>> > ice-.htm). > > > Best Regards, > Brent Fraser > > > -------- Original
>> Message -------- >> From: "Christopher Hughes" <chughes at co.lincoln.or.us>
>>>> Sent: June 12, 2020 9:20 AM >> To: "GeoMoose Users"
>> <geomoose-users at lists.osgeo.org> >> Subject: [Geomoose-users] GeoMoose
>> 3 -
>> AGS Legend Support >> >> Is there support for AGS legends in GeoMoose 3?
>> Particularly for vector >> layers with multiple classes where the meaning
>> of the symbology isn't >> readily >> apparent. >> >> I tried turning
>> on the
>> legend for the ags services in the demo > (railroads >> and the Nat Geo
>> world map) and was unsuccessful. >> >> Best, >> Chris >> >> -- >> 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 > > >
>> _______________________________________________ > Geomoose-users mailing
>> list > Geomoose-users at lists.osgeo.org >
>> https://lists.osgeo.org/mailman/listinfo/geomoose-users
>> _______________________________________________ Geomoose-users mailing
>> list
>> Geomoose-users at lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/geomoose-users
>>
>>
>
> _______________________________________________
> 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