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

enable metadata document parsing #6876

Closed
gannebamm opened this issue Jan 26, 2021 · 2 comments
Closed

enable metadata document parsing #6876

gannebamm opened this issue Jan 26, 2021 · 2 comments
Labels
enhancement feature A new feature to be added to the codebase
Milestone

Comments

@gannebamm
Copy link
Contributor

gannebamm commented Jan 26, 2021

Is your feature request related to a problem? Please describe.
If I upload a metadata XML (like ISO-19139) file as document the metadata should be used to prefill the GeoNode fields just like using a metadata XML file alongside a shapefile.

Describe the solution you'd like
The metadata XML parsing is already implemented for layer uploads. The used code and methods can be found here:

https://github.com/GeoNode/geonode/blob/master/geonode/layers/metadata.py#L40

Just to have a proof of concept I hacked the above implementation into the current document views.py:

views.py.diff.txt

This will work but is not the solution I would like!

A better option is to refactor the XML parsing and move the code to the base model since the ResourceBase model does provide all metadata fields for all its child (Layer, Document, App, Map). The whole metadata.py file should move to https://github.com/GeoNode/geonode/tree/master/geonode/base.

Describe alternatives you've considered
I took a look at replicating the XML parsing code for documents and think it will be almost identical. Better to improve the generic metadata parsing and maybe use some conditionals in there to make special stuff happen for documents / layers instead of not being DRY.

Additional context
If the Documents API will enable uploads in the future this feature can be used to create a 'harvesting' like CSW ingestion of metadata.

@gannebamm gannebamm added feature A new feature to be added to the codebase enhancement labels Jan 26, 2021
@gannebamm
Copy link
Contributor Author

@t-book @afabiani @francbartoli

We had a talk about this kind of behaviour in the rejected GNIP #6744. Do you think this approach is a better fit for the requested feature?

@gannebamm
Copy link
Contributor Author

We at Thünen do use this. To get the code 'upstream ready' I would have to rewrite and refactor most of it. If this Feature Request is of general interest we can work on that.

These are the code changes as patch file: https://gist.github.com/gannebamm/965628b5e71361f7010a7b5b9dff1586

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement feature A new feature to be added to the codebase
Projects
None yet
Development

No branches or pull requests

2 participants