Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a model in core to handle KML functionality #928

Closed
Hallbergs opened this issue Nov 24, 2021 · 0 comments
Closed

Create a model in core to handle KML functionality #928

Hallbergs opened this issue Nov 24, 2021 · 0 comments
Assignees
Labels
module:client/core Core functionality (not a plugin)
Milestone

Comments

@Hallbergs
Copy link
Member

Hallbergs commented Nov 24, 2021

We've seen issues when importing some .kml-files, and we've narrowed down the files prone for errors to files containing features which are imported with the KML-parser as geometryCollections.

I checked the code and sure enough, geometryCollections are not supported in the tanslateImportedFeature-method.

Proposed suggestion:
Create a new model in Core that can be used trough out the application. The model should implement methods that are often used when dealing with kml. So far, the following methods have been implemented:

  • parseFeatures(kmlString, settings):
    • Accepts a KML-string and tries to parse it to OL-features. Returns an object containing {features: <Array of OL-features>, error: <String with error message || null> }. The optional settings-object accepts a prepareForMapInjection <bool> (defaults to true) parameter, stating if the features should be transformed so that they can be easily added to the map.
  • import(kmlString, settings):
    • Accepts a KML-string and adds the KML-features to the layer. Returns an object containing {status: <string>, error: <String with error message || null> }. The optional settings-object accepts a zoomToExtent <bool> (defaults to true) parameter, stating if the map view should be fit to the extent of the features in the current kml-source.
  • export():
    • Exports all features in the current kml-source.
  • removeImportedFeatures():
    • Removes all imported features from the current kml-source.
  • zoomToCurrentExtent():
    • Zooms the map to the current extent of the kml-source.
  • setLayer(layerName):
    • Accepts a string containing a layer name. Will set the current kml-source and layer.
  • getCurrentLayerName():
    • Returns the name of the vectorLayer that is currently connected to the model.
  • getCurrentExtent():
    • Returns the current extent of the current kml-source.

Any thoughts on more functionality?

@Hallbergs Hallbergs added the plugin:draw Functionality and features of the Draw plugin label Nov 24, 2021
@Hallbergs Hallbergs added this to the 3.x milestone Nov 24, 2021
@Hallbergs Hallbergs self-assigned this Nov 24, 2021
@Hallbergs Hallbergs changed the title The kml-importer cannot handle geometryCollections The kml-importer cannot handle multiGeometries Nov 24, 2021
@Hallbergs Hallbergs changed the title The kml-importer cannot handle multiGeometries Create a model in core to handle kml-functionality Nov 25, 2021
@Hallbergs Hallbergs added module:client/core Core functionality (not a plugin) and removed plugin:draw Functionality and features of the Draw plugin labels Nov 25, 2021
@Hallbergs Hallbergs modified the milestones: 3.x, 3.9 Nov 29, 2021
@jacobwod jacobwod changed the title Create a model in core to handle kml-functionality Create a model in core to handle KML functionality Dec 13, 2021
@jacobwod jacobwod modified the milestones: 3.9, 3.8 Dec 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module:client/core Core functionality (not a plugin)
Projects
None yet
Development

No branches or pull requests

2 participants