[mapserver-users] Mapserver: set symbol on lines according to line features length
Eichner, Andreas - SID
Andreas.Eichner at sid.sachsen.de
Mon Nov 30 07:25:01 PST 2015
AFAIK you need to preprocess your data and use CLASSes in your map file. Using OGR or a SQL database you might be able to do this on the fly within your DATA. For example, the command
$ ogrinfo -dialect sqlite -sql "select st_length(geometry) > 10 as longenough from water_pipes" water_pipes.shp
creates a computed field containing 1 if the line geometry has a length greater than 10. You can then classify on this an apply a symbolization conditionally:
LAYER
CLASS
EXPRESSION "([longenough] != 0)"
STYLE
SYMBOL "wp_arrow"
GAP -100
COLOR 255 0 0
OFFSET -5 -99
SIZE 6
END
END
CLASS
# default style goes here
END
END
I have not tested this but it might give you a hint how to accomplish it.
HTH
> -----Ursprüngliche Nachricht-----
> Von: mapserver-users [mailto:mapserver-users-bounces at lists.osgeo.org] Im
> Auftrag von wiltomap
> Gesendet: Montag, 30. November 2015 13:34
> An: mapserver-users at lists.osgeo.org
> Betreff: [mapserver-users] Mapserver: set symbol on lines according to
> line features length
>
> I need to display arrows alongside to line features. Lines represent water
> pipes. The issue I'm facing is that lines are a concatenation of numerous
> line features of various lengths. Therefore, symbols are attached to every
> line, whatever its length. This makes symbols either overlaying or
> touching
> eachother (as in example below).
>
> <http://osgeo-org.1560.x6.nabble.com/file/n5239136/wpp.png>
>
> Inside my mapfile, I define the display rules of my symbols in the STYLE
> element:
>
> STYLE
> SYMBOL "wp_arrow"
> GAP -100
> COLOR 255 0 0
> OFFSET -5 -99
> SIZE 6
> END
>
> I would like these rules to apply only to line features being more than 10
> meters long (or x map units).
>
> Thanks in advance for help or any advice!
>
>
> Thomas
>
>
>
>
> --
> View this message in context: http://osgeo-
> org.1560.x6.nabble.com/Mapserver-set-symbol-on-lines-according-to-line-
> features-length-tp5239136.html
> Sent from the Mapserver - User mailing list archive at Nabble.com.
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
More information about the MapServer-users
mailing list