Add SLD export support custom vector symbols and hatch fills - #7591
Open
geographika wants to merge 21 commits into
Open
Add SLD export support custom vector symbols and hatch fills#7591geographika wants to merge 21 commits into
geographika wants to merge 21 commits into
Conversation
Member
Author
|
A few more commits after further testing with various symbols and properties.
|
Member
Author
|
Documentation PR also added. I'll leave these open for a week if anyone has any comments or questions before merging. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request allows more MapServer vector styles to be accessed as SLD through WMS
GetStylesrequests. Styles in a Mapfile can then used by both MapServer, and by a client web application.Background
SLD can be generated through MapServer URLs such as https://demo.mapserver.org/cgi-bin/wms?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetStyles&layers=country_bounds which in this example returns the SLD of the
country_boundslayer. This SLD can be read, for example (and for my main use case), by using the GeoStyler SLD Parser in a browser and applying it to a vector layer in OpenLayers using the GeoStyler OpenLayers parser.MapServer currently supports exporting the 6 WellKnownName names in the core SLD specification - square, circle, triangle, star, cross, x. If these are used in a MapServer layer then the
GetStylesrequest returns SLD such as:Updates
Hatches
This pull request adds support for hatch fills which are supported by GeoServer, and GeoStyler.
A Mapfile containing:
Will now produce the following SLD:
The code will calculate the closest matching angle, so 80° will display as 90°, and output the following WellKnownNames:
Custom Vector Symbols
This PR also adds support for exporting any generic
SYMBOLto SLD, by exporting it as an SVG, and then encoding it (to make it smaller in size), using GDAL'sCPLBase64Encodefunction (GDAL is already a required MapServer dependency). Embedding the SVG in the SLD file avoids external markers and files, and issues around paths and security.For example a Mapfile with the following:
Will produce a
GetStylesresponse of:Ellipse symbols are also handled (by a separate function):
Initially, I only added support for symbols which matched some of the GeoServer conventions such as
shape://hexagon, but a generic SYMBOL to SVG function handles both "named" shapes and any other custom symbols, includingthose with gaps using the
-99 -99breaks in thePOINTSblock. The older approach can be seen in earlier commits (e,g, 5173216).Code and examples all written by me, with a review of the C++ by Claude.