[mapserver-users] getting the scale in a map file at runtime

Scott public at postholer.com
Sat Jun 4 08:29:25 PDT 2022


If you're using an SQL query in your map file and it's a WMS/WFS (maybe 
others) service, you can determine scale from !BOX!, %WIDTH%, %HEIGHT%.

To add to your question, I'd be curious to know does a resource exist 
that lists all '[var]' resources available to a map file at run time?


On 6/3/22 08:00, Richard Greenwood wrote:
> On Fri, Jun 3, 2022 at 8:43 AM Jörg Thomsen (WhereGroup) 
> <joerg.thomsen at wheregroup.com <mailto:joerg.thomsen at wheregroup.com>> wrote:
> 
>     Richard,
>     sorry, yes, sure...
> 
>     Perhaps you can use scaletoken? It's not the same as you are searching
>     for, but you could define a set of tolerance-values for different
>     scales.
> 
> 
> Yes - I had not thought of that. It might be a better way than what I 
> was trying to do. Thank you!
> 
> 
>     Am 03.06.22 um 16:21 schrieb Richard Greenwood:
>      >
>      >
>      > On Fri, Jun 3, 2022 at 8:00 AM Jörg Thomsen (WhereGroup)
>      > <joerg.thomsen at wheregroup.com
>     <mailto:joerg.thomsen at wheregroup.com>
>     <mailto:joerg.thomsen at wheregroup.com
>     <mailto:joerg.thomsen at wheregroup.com>>> wrote:
>      >
>      >     Hi,
>      >
>      >     what about:
>      > https://mapserver.org/mapfile/template.html#image-geometry
>     <https://mapserver.org/mapfile/template.html#image-geometry>
>      >     <https://mapserver.org/mapfile/template.html#image-geometry
>     <https://mapserver.org/mapfile/template.html#image-geometry>>
>      >     -> scaledenom
>      >
>      >     Doesn't work?
>      >
>      >
>      > Thanks, but no, it does not work. I'm trying to access the scale
>     in a
>      > map file, not in a template. Using square brackets [variable] is
>      > interpreted as a field name in the data, not as a runtime
>     variable. For
>      > example:
>      >    CLASS
>      >      STYLE
>      >        GEOMTRANSFORM (generalize([shape], [scaledenom]))
>      >        COLOR "#2AB1F7"
>      >      END
>      >    END
>      > returns the error:
>      > DBASE file error. Item 'scaledenom' not found.
>      >
>      >
>      >     Jörg
>      >
>      >
>      >     Am 03.06.22 um 15:45 schrieb Richard Greenwood:
>      >      > Can I get the current scale for use in a map file at runtime.
>      >      > Specifically, I'd like to use it in a geotransform
>     something like:
>      >      >     GEOMTRANSFORM (generalize([shape], [scale]))
>      >      > or more likely for use in an expression:
>      >      >     GEOMTRANSFORM (generalize([shape], [scale] / 100))
>      >      > Thanks
>      >      > --
>      >      > Richard W. Greenwood
>      >      > www.greenwoodmap.com <http://www.greenwoodmap.com>
>     <http://www.greenwoodmap.com <http://www.greenwoodmap.com>>
>      >     <http://www.greenwoodmap.com <http://www.greenwoodmap.com>
>     <http://www.greenwoodmap.com <http://www.greenwoodmap.com>>>
>      >      >
>      >      > _______________________________________________
>      >      > MapServer-users mailing list
>      >      > MapServer-users at lists.osgeo.org
>     <mailto:MapServer-users at lists.osgeo.org>
>      >     <mailto:MapServer-users at lists.osgeo.org
>     <mailto:MapServer-users at lists.osgeo.org>>
>      >      > https://lists.osgeo.org/mailman/listinfo/mapserver-users
>     <https://lists.osgeo.org/mailman/listinfo/mapserver-users>
>      >     <https://lists.osgeo.org/mailman/listinfo/mapserver-users
>     <https://lists.osgeo.org/mailman/listinfo/mapserver-users>>
>      >
>      >
>      >     --
>      >     Viele Grüße,
>      >     Jörg Thomsen
>      >
>      >     ---------------------------------------------
>      >     Aufwind durch Wissen!
>      >     Jetzt neu: Web-Seminare und Online-Schulungen
>      >     bei der www.foss-academy.com <http://www.foss-academy.com>
>     <http://www.foss-academy.com <http://www.foss-academy.com>>
>      >     ---------------------------------------------
>      >
>      >     Jörg Thomsen
>      >     WhereGroup GmbH
>      >     Bundesallee 23
>      >     10717 Berlin
>      >     Germany
>      >
>      >     Tel: +49 (0)30 / 5130 278 74
>      >     Fax: +49 (0)30 / 5130 278 11
>      >
>      > joerg.thomsen at wheregroup.com
>     <mailto:joerg.thomsen at wheregroup.com>
>     <mailto:joerg.thomsen at wheregroup.com
>     <mailto:joerg.thomsen at wheregroup.com>>
>      > www.wheregroup.com <http://www.wheregroup.com>
>     <http://www.wheregroup.com <http://www.wheregroup.com>>
>      >
>      >     Geschäftsführer:
>      >     Olaf Knopp, Peter Stamm
>      >     Amtsgericht Bonn, HRB 9885
>      >
>      >     -------------------------------
>      >     Folgen Sie der WhereGroup auf twitter:
>      > http://twitter.com/WhereGroup_com
>     <http://twitter.com/WhereGroup_com>
>     <http://twitter.com/WhereGroup_com <http://twitter.com/WhereGroup_com>>
>      >     _______________________________________________
>      >     MapServer-users mailing list
>      > MapServer-users at lists.osgeo.org
>     <mailto:MapServer-users at lists.osgeo.org>
>     <mailto:MapServer-users at lists.osgeo.org
>     <mailto:MapServer-users at lists.osgeo.org>>
>      > https://lists.osgeo.org/mailman/listinfo/mapserver-users
>     <https://lists.osgeo.org/mailman/listinfo/mapserver-users>
>      >     <https://lists.osgeo.org/mailman/listinfo/mapserver-users
>     <https://lists.osgeo.org/mailman/listinfo/mapserver-users>>
>      >
>      >
>      >
>      > --
>      > Richard W. Greenwood
>      > www.greenwoodmap.com <http://www.greenwoodmap.com>
>     <http://www.greenwoodmap.com <http://www.greenwoodmap.com>>
> 
> 
>     -- 
>     Viele Grüße,
>     Jörg Thomsen
> 
>     ---------------------------------------------
>     Aufwind durch Wissen!
>     Jetzt neu: Web-Seminare und Online-Schulungen
>     bei der www.foss-academy.com <http://www.foss-academy.com>
>     ---------------------------------------------
> 
>     Jörg Thomsen
>     WhereGroup GmbH
>     Bundesallee 23
>     10717 Berlin
>     Germany
> 
>     Tel: +49 (0)30 / 5130 278 74
>     Fax: +49 (0)30 / 5130 278 11
> 
>     joerg.thomsen at wheregroup.com <mailto:joerg.thomsen at wheregroup.com>
>     www.wheregroup.com <http://www.wheregroup.com>
> 
>     Geschäftsführer:
>     Olaf Knopp, Peter Stamm
>     Amtsgericht Bonn, HRB 9885
> 
>     -------------------------------
>     Folgen Sie der WhereGroup auf twitter:
>     http://twitter.com/WhereGroup_com <http://twitter.com/WhereGroup_com>
> 
> 
> 
> -- 
> Richard W. Greenwood
> www.greenwoodmap.com <http://www.greenwoodmap.com>
> 
> _______________________________________________
> MapServer-users mailing list
> MapServer-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapserver-users


More information about the MapServer-users mailing list