Skip to content

Instantly share code, notes, and snippets.

@brncsk
Last active August 29, 2015 14:27
Show Gist options
  • Save brncsk/f5dca3bb1de147cad217 to your computer and use it in GitHub Desktop.
Save brncsk/f5dca3bb1de147cad217 to your computer and use it in GitHub Desktop.
pr.md

Switch away from SLD-based export, use a custom exporter instead

Given that SLD support is incomplete in both QGis and MapServer, this PR gets rid of the SLD-based exporter and introduces a new method for exporting vector layer styles into a mapfile. While our exporter is still far from perfect, we believe it already provides a more faithful rendering of complex vector styles than what this plugin currently has to offer (see Figures 1 to 3).

The further development of this plugin was sponsored by ViaMap Ltd. in the frame of transferring a municipal GIS system from Intergraph technology to opensource GIS stack. The project was commissioned by the Municipality of 11th District of Budapest, Hungary.

Support is added for the following features:

  • Line Pattern Fills and Point Pattern Fills
  • Font Marker symbols
  • SVG symbols (also with embedded/linked raster images)
  • Line cap and line join styles
  • Multi-layer fills and lines
  • A subset of SLD well-known markers

Other changes introduced by this PR:

  • Line widths and symbol sizes are now computed more accurately
  • Enhanced labeling (support for partial labels, etc.)
  • A more modular approach to the structure of the source code
  • Added basic testing facilities and data in form of a PyQgis script and additional infrastructure for running it in a *NIX environment.
  • Options for labeling (Force and Partials) were removed from the Advanced tab. The same effect can be achieved by using the following settings:
    • FORCE is enabled by checking the Labels → Rendering → Show all labels... checkbox in Layer Settings (See Figure 4).
    • PARTIALS is enabled by checking the Show partial labels checkbox in the Automated placement settings dialog box (available by clicking the button in the upper right corner of the Label tab in Layer Settings; see Figure 5). (Please note that as this setting is applied to all layers in QGis it also will be applied to all layers in the mapfile.)

Our approach also has a couple of shortcomings:

  • As the value of the SIZEUNITS setting can only be set per-layer in a mapfile (as opposed to a per-style-attribute approach in QGis), we use millimeters as the default size unit and switch if and only if the layer has a style attribute with "Map unit" set as its unit.
  • Lots of symbol layer styles and style attributes are unsupported at the moment.

Images for visual comparison:

Fig. 1. – Original QGis project: QGis

Fig. 2. – Mapfile exported by the plugin in its current form: Original plugin

Fig. 3. – Mapfile eported by the plugin version in this proposed PR: Proposed PR

Fig. 4. – Enabling FORCE in the mapfile Enabling FORCE in the mapfile

Fig. 5. – Enabling PARTIALS in the mapfile

Enabling PARTIALS in the mapfile

@csandor
Copy link

csandor commented Aug 17, 2015

The further development of this plugin was sponsored by ViaMap Ltd. in the frame of transferring a municipal GIS system from Intergraph technology to opensource GIS stack. The project was commissioned by the Municipality of 11th District of Budapest, Hungary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment