bcgov / smk-legacy-ui

Legacy Admin UI for the SMK has been de-supported. Please see the CLI under https://github.com/bcgov/smk for an alternative.
Apache License 2.0
8 stars 3 forks source link

KML multi-icon layer handling #205

Open dhlevi opened 6 years ago

dhlevi commented 6 years ago

SMK currently only loads a single kml icon style for the whole uploaded layer. Decide on handling for this scenario in SMK to either allow a layer to have multiple marker styles, or to split the data into multiple layers.

See the BC Parks KML for an example of this behaviour.

qqnluaq commented 6 years ago

One way to handle this:

When parsing the KML file, if there are multiple styles defined, then create an output geojson for each style. Each feature from the KML goes into exactly one output file.

Now the user is given 3 options:

  1. Add those vector layers to the map as N seperate layers.
  2. Make a layer folder with those vector layers.
  3. Make a layer group with those vector layers.

A layer folder contains 1 or more layers. The folder has a visibility flag that controls all the child layers. Each child layer also has a visibility flag. In the layers panel, the child layers are visible under the parent.

A layer group, is like a layer folder except that the child layers are not exposed to the user. The layer group appears in the layer list as a single layer, and it's internal structure is not exposed. The parent has a visibility flag that controls the child layers.

So, if a KML file with multiple styles is loaded, a layer group can be constructed that contains a vector layer for each style, but behaves in the client like a single layer.

qqnluaq commented 6 years ago

Another related idea:

Some geodata formats, shapefiles and geojson for example, can be hetrogeneous. Each feature in these files can have a different geometry type (point, line, polygon). It may be desirable to style each type of geometry differently. The approach described above would allow this, if the input file was partitioned into multiple output files by geometry type.

cpspicer commented 6 years ago

Looks good!

dhlevi commented 6 years ago

Handler added to Admin UI to split KML files with multiple styles into seperate layers. This will also trigger when replacing data from a layer, by matching generated ID's and updating their attachments. In the event you've changed an ID or renamed a style in the source KML, it will generate new layers.

dhlevi commented 6 years ago

Note, code is in place on the service to handle the same behaviours for KMZ uploads, but a handler is yet to be completely implemented on the Admin UI. This will be coming shortly.

qqnluaq commented 6 years ago

Code complete in client to allow layers to organized into folders & groups. This is done with configuration on the layers tool. Docs: https://github.com/bcgov/smk/wiki/SMK-Client-Configuration#layers-tool

dhlevi commented 6 years ago

KMZ upload handling for url icons has been added