Skip to content

BGDIINF_SB-2610: enhance legacy kml import#297

Merged
pakb merged 11 commits intodevelopfrom
feat-BGDIINF_SB-2610-enhance-legacy-kml-import
Nov 29, 2022
Merged

BGDIINF_SB-2610: enhance legacy kml import#297
pakb merged 11 commits intodevelopfrom
feat-BGDIINF_SB-2610-enhance-legacy-kml-import

Conversation

@jedef
Copy link
Contributor

@jedef jedef commented Nov 16, 2022

When importing a kml from mf-geoadmin3, the viewer is now able to reconstruct the editable feature based on the style infomration that is stored in the kml.

Test link

@jedef jedef force-pushed the feat-BGDIINF_SB-2610-enhance-legacy-kml-import branch from afb2ec8 to 8285919 Compare November 16, 2022 18:50
@jedef jedef requested a review from pakb November 17, 2022 11:59
@ltshb
Copy link
Contributor

ltshb commented Nov 17, 2022

@pakb @jedef I'm wondering how do you check if the KML is from the old viewer or from the new ? You don't make use of the author or authorVersion info from the backend ? Or did I missed something?

@jedef
Copy link
Contributor Author

jedef commented Nov 17, 2022

@pakb @jedef I'm wondering how do you check if the KML is from the old viewer or from the new ? You don't make use of the author or authorVersion info from the backend ? Or did I missed something?

The check is made in "src/api/features.api.js" line 255 - 257 without the use of the metadata from the backend. It would surely be more robust to also check the metadata from the backend, but I think that this can be implemented when we also implement the check to make sure that old kmls are always read only, as I don't think that I have enough time this afternoon to do this.

@pakb pakb force-pushed the feat-BGDIINF_SB-2610-enhance-legacy-kml-import branch from 1a40222 to a540de6 Compare November 22, 2022 09:23
@ltshb ltshb force-pushed the feat-BGDIINF_SB-2610-enhance-legacy-kml-import branch from a540de6 to 94086ea Compare November 22, 2022 10:49
Copy link
Contributor

@pakb pakb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's some issue with unit tests, seems like it is using axios or some other libs (that shouldn't happen while unit testing)
Plus the parsing of the old KML doesn't parse the icon color correctly, I'll investigate while @jedef is in vacations

jedef and others added 11 commits November 29, 2022 11:35
Added a parser that can generate an editable feature from an olFeature
that was just created from a KML file.
The old viewer now recognizes the feature types if it reads a kml file
generated by the new viewer.
…wer.

Parse the icon url format from the old viewer to recreate the editable
feature. Also added some comments.
- Editable feature and ol feature now share the same id, so that it is
  not necessary to do string transformations to translate between the
  two.
- When importing an old kml, the old id format is translated to the new
  id format when importing
- Now the id is generated using a timestamp. This should reduce the
  chances of collision.
- set coordinates an id correctly on olFeature
- added a new text size to be compatible with the old viewer
- added documentation
Reversed the fix for backward compatibility, as it caused some issues
and was not needed, as we only want to support forward compatibility.
Moving all legacy KML utils function into a dedicated file, also moving along related tests
Removing the import of the store in the utils function and passing requirements as params instead

Renaming Icon class into DrawingIcon (and DrawingIconSet instead of IconSet) in order not to mix match the name with OpenLayers Icon class
Renaming default Feature class into SelectableFeature, same as above, so that it does not collide with OpenLayers Feature class (and having one word class name is a bad practice anyway)
@pakb pakb force-pushed the feat-BGDIINF_SB-2610-enhance-legacy-kml-import branch from 94086ea to 22ae41d Compare November 29, 2022 10:35
@pakb pakb merged commit 18335bc into develop Nov 29, 2022
@pakb pakb deleted the feat-BGDIINF_SB-2610-enhance-legacy-kml-import branch November 29, 2022 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants