[MS4W-Users] dynamic line pattern

Brent Fraser bfraser at GeoAnalytic.com
Wed Mar 27 16:47:48 EDT 2019


Robert,
  
   Yep, that is the traditional way.  But it can make for verbose mapfiles, 
and if your data changes frequently it can be a pain to update.
  
 Best Regards,
 Brent Fraser
  
  
  
 -------- Original Message --------
> From: "Robert Sanson via MS4W-Users" <ms4w-users at lists.ms4w.com>
> Sent: Wednesday, March 27, 2019 2:33 PM
> To: "Discussions for MS4W (MapServer for Windows)" 
<ms4w-users at lists.ms4w.com>
> Cc: "Robert Sanson" <Robert.Sanson at asurequality.com>
> Subject: Re: [MS4W-Users] dynamic line pattern
>
> Why not use CLASSITEM and CLASS with an EXPRESSION for each possible 
value? See this layer from a mapfile:
>
> LAYER
> NAME elines
> GROUP "FMS"
> TYPE LINE
> STATUS ON
> CONNECTION "./elines.ovf"
> CONNECTIONTYPE OGR
> DATA "elines"
> FILTER "WHERE farm_id = '%farmid%' and spatial_feature_type = 3 and 
end_date is null"
> VALIDATION
> 'farmid' '^[A-Z]{2}[0-9]{5}$'
> END
> CLASSITEM "sub_area_code"
> CLASS
> NAME "AWDS"
> EXPRESSION "AWDS"
> STYLE
> PATTERN 5.0 5.0 END
> WIDTH 4
> COLOR 52 207 173
> END
> END #CLASS
> CLASS
> NAME "AWFE"
> EXPRESSION "AWFE"
> STYLE
> WIDTH 4
> COLOR 207 52 86
> END
> END #CLASS
> CLASS
> NAME "AWPT"
> EXPRESSION "AWPT"
> STYLE
> PATTERN 6.0 7.0 END
> WIDTH 4
> COLOR 207 52 86
> END
> END #CLASS
> CLASS
> NAME "AWUN"
> EXPRESSION "AWUN"
> STYLE
> PATTERN 0.5 7.0 END
> WIDTH 4
> COLOR 207 52 86
> END
> END #CLASS
> CLASS
> NAME "BELT"
> EXPRESSION "BELT"
> STYLE
> WIDTH 6
> COLOR 33 145 0
> END
> END #CLASS
> CLASS
> NAME "CNAL"
> EXPRESSION "CNAL"
> STYLE
> WIDTH 4
> COLOR 192 154 31
> END
> END #CLASS
> CLASS
> NAME "DRIN"
> EXPRESSION "DRIN"
> STYLE
> PATTERN 7.0 1.0 END
> WIDTH 4
> COLOR 255 163 0
> END
> END #CLASS
> CLASS
> NAME "PIPE"
> EXPRESSION "PIPE"
> STYLE
> PATTERN 7.0 1.0 END
> WIDTH 4
> COLOR 255 163 0
> END
> END #CLASS
> CLASS
> NAME "RIPA"
> EXPRESSION "RIPA"
> STYLE
> WIDTH 4
> COLOR 122 65 0
> END
> END #CLASS
> CLASS
> NAME "RPPL"
> EXPRESSION "RPPL"
> STYLE
> PATTERN 0.5 7.0 END
> WIDTH 4
> COLOR 122 65 0
> END
> END #CLASS
> CLASS
> NAME "ROFE"
> EXPRESSION "ROFE"
> STYLE
> WIDTH 3
> COLOR 163 207 67
> END
> END #CLASS
> CLASS
> NAME "ROPT"
> EXPRESSION "ROPT"
> STYLE
> PATTERN 5.0 7.0 END
> WIDTH 3
> COLOR 163 207 67
> END
> END #CLASS
> CLASS
> NAME "ROUN"
> EXPRESSION "ROUN"
> STYLE
> PATTERN 0.2 6.0 END
> WIDTH 3
> COLOR 163 207 67
> END
> END #CLASS
> CLASS
> NAME "SWTL"
> EXPRESSION "SWTL"
> STYLE
> WIDTH 4
> COLOR 158 0 242
> END
> END #CLASS
> CLASS
> NAME "WRDR"
> EXPRESSION "WRDR"
> STYLE
> #PATTERN 4.0 4.0 END
> WIDTH 3
> COLOR 0 0 255
> END
> END #CLASS
> CLASS
> NAME "WRNF"
> EXPRESSION "WRNF"
> STYLE
> PATTERN 0.3 6.0 END
> WIDTH 3
> COLOR 255 153 0
> END
> END #CLASS
> METADATA
> "ows_title" "elines"
> "ows_abstract" "This is the Environmental Lines layer in NZTM"
> "ows_keywordlist" "AGRIBASE"
> "wms_opaque" "1"
> "wms_group_title" "FMS"
> "ows_extent" "1114412.940 4793178.168 2089186.204 6190213.601"
> END
> END #elines
>
> -----Original Message-----
> From: MS4W-Users <ms4w-users-bounces at lists.ms4w.com> On Behalf Of Brent 
Fraser via MS4W-Users
> Sent: Thursday, 28 March 2019 9:23 a.m.
> To: MS4W-Users at lists.ms4w.com
> Cc: Brent Fraser <bfraser at GeoAnalytic.com>
> Subject: Re: [MS4W-Users] dynamic line pattern
>
> Sven,
>
> My old notes on styling:
>
> ------ Mapserver Styling Strategies ------ 1. Values hard-coded in 
mapfile 2. Values substituted from database attribute values (AKA 
"attribute
> binding")
> - not all values can use [attribute] as a value, eg PATTERN 3. Entire 
Style from attribute using STYLEITEM:
> STYLEITEM "mystyleattribute" # Mapserver or OGR format
> STYLEITEM AUTO # OGR driver only (useful for DXF,DWG, format data
> etc)
> - since STYLEITEM is a LAYER object, are multiple classes possible?
> 4. Entire STYLE block from Javascript (STYLEITEM 
"javascript:///home/user/myscript.js" # absolute path) 5. Style from SLD 
[URL] reference
> (&SLD=http://demo.mapserver.org/ogc-demos/map/sld/sld_line_simple.xml)
>
> You could try #3 (I've never done it but it could work): STYLEITEM 
<attribute>
>
> Have a look at teh STYLEITEM at https://mapserver.org/mapfile/layer.html
>
> Best Regards,
> Brent Fraser
>
>
> -------- Original Message --------
> > From: "Sven Schroeter via MS4W-Users" <ms4w-users at lists.ms4w.com>
> > Sent: Wednesday, March 27, 2019 10:57 AM
> > To: MS4W-Users at lists.ms4w.com
> > Cc: "Sven Schroeter" <schroeter at netgis.de>
> > Subject: [MS4W-Users] dynamic line pattern
> >
> > Hi,
> >
> > I have a line Layer and want to change the pattern dynamicly from the
> > attribute table.
> > Is it possible?
> >
> >
> > e.g. I have this working:
> >
> > CLASS
> > NAME "buslines"
> > STYLE
> > COLOR [linecolor]
> > WIDTH 4
> > PATTERN 40 10 END
> > END
> > END # CLASS
> >
> >
> > and I want to get the pattern from an attribute:
> >
> >
> > CLASS
> > NAME "buslines"
> > STYLE
> > COLOR [linecolor]
> > WIDTH 4
> > PATTERN [pattern] END
> > END
> > END # CLASS
> >
> > but this dont work. Any hint?
> >
> > Thanks
> > Sven
> >
> > _______________________________________________
> > MS4W-Users mailing list
> > MS4W-Users at lists.ms4w.com
> > https://lists.ms4w.com/mailman/listinfo/ms4w-users
>
>
> _______________________________________________
> MS4W-Users mailing list
> MS4W-Users at lists.ms4w.com
> https://lists.ms4w.com/mailman/listinfo/ms4w-users
> _______________________________________________
> MS4W-Users mailing list
> MS4W-Users at lists.ms4w.com
> https://lists.ms4w.com/mailman/listinfo/ms4w-users




More information about the MS4W-Users mailing list