Skip to content

GSIP 160

Justin Deoliveira edited this page Jun 28, 2017 · 12 revisions

GSIP 160 - Options for KML Placemark placement

Overview

The subject of this proposal is the addition of options for KML encoding to control the placement of placemark icons, mostly for polygons.

Proposed By

Justin Deoliveira

Assigned to Release

This proposal is for GeoServer 2.12

State

  • Under Discussion
  • In Progress
  • Completed
  • Rejected
  • Deferred

Motivation

Currently in KML output placemark icons are placed simply by using the centroid of a geometry. While this works much of the time there are instances where it is not desirable. Such as:

  1. A geometry is irregularly shaped (think of a "C" shaped polygon) and the centroid doesn't fall within the polygon.
  2. The centroid of a geometry falls outside of the request viewport, resulting in the display of a geometry without it's placemark icon.

Proposal

The current patch can be found here.

The proposal is to add a new format option for kml called "kmcentroid" that would allow for controlling how the "centroid" is computed. This new option would allow for the following:

  1. To use a sampling approach to finding a central point of the geometry rather than just the centroid. This is the same approach that the image renderer uses when placing labels and graphics to solve similar issues. This addresses problem 1 above.

  2. To clip the geometry with the viewport before calculating the centroid. Again something the image renderer does and a solution to problem 2 above.

The syntax of the new option would introduce another level of key value pairs to specify which options to turn on, and in the case of the sampling to which degree to sample. The following is an example:

&format_options=kmcentroid:contain@true,samples@10,clip@true

Which specifies that the centroid must be contained by the geometry, to use 10 samples to derive it, and also to clip the geometry before choosing the point.

An alternative syntax would be to use additional top level format options for the parameters. Such as:

&format_options=kmcentroid_contain:true;kmcentroid_samples:10;kmcentroid_clip:true

If there is a consensus that the second syntax is better I'll happily change it.

Backwards Compatibility

This proposal is 100% additive, no default behaviour will be changed.

Discussion

Voting

Project Steering Committee:

  • Alessio Fabiani:
  • Andrea Aime:
  • Ben Caradoc-Davies:
  • Brad Hards:
  • Christian Mueller:
  • Ian Turton:
  • Jody Garnett:
  • Jukka Rahkonen:
  • Kevin Smith:
  • Simone Giannecchini:

Links

Clone this wiki locally