Skip to content

enable metadata document parsing #6876

@gannebamm

Description

@gannebamm

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementfeatureA new feature to be added to the codebase

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions