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

Problem uploading metadata to an existing layer #498

Open
ardean80 opened this issue Nov 10, 2023 · 5 comments
Open

Problem uploading metadata to an existing layer #498

ardean80 opened this issue Nov 10, 2023 · 5 comments

Comments

@ardean80
Copy link

ardean80 commented Nov 10, 2023

Hi,
I'm having a problem in uploading a standard xml metadata file (created with GeoNode itself) to a previously uploaded layer.
I'm getting this error:

`Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.10/dist-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python3.10/dist-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/django/views/decorators/http.py", line 40, in inner
    return func(request, *args, **kwargs)
  File "/usr/src/geonode/geonode/layers/views.py", line 150, in dataset_upload
    return dataset_upload_metadata(request)
  File "/usr/src/geonode/geonode/layers/views.py", line 173, in dataset_upload_metadata
    dataset_uuid, vals, regions, keywords, _ = parse_metadata(open(base_file).read())
  File "/usr/lib/python3.10/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xef in position 0: ordinal not in range(128)`

I have this error even on the same instance of GeoNode (-project), if I try to export manually edited metadata from an existing layer and then I try to import again the standard xml file on the same layer.
I'm working on the latest version (4.1.3).
Am I doing something wrong?

@etj
Copy link
Contributor

etj commented Nov 10, 2023

Related to #464 ?

@ardean80
Copy link
Author

ardean80 commented Nov 10, 2023

It could be.
How can I fix it? Just setting LANG and LANGUAGE env vars into the .env file and running a up -d again?
I see there should be a fix (https://github.com/GeoNode/geonode-project/pull/465/files), I'm going to check if it works for me.
Anyway, why those lines are not present in the Dockerfile from tag 4.1.3? Will they be available in the next tag?

@ardean80
Copy link
Author

ardean80 commented Nov 10, 2023

It worked...but now the error has changed into this one:

Client Error: Not Found The UUID identifier from the XML Metadata, is different from the one saved

This can be solved manually editing the xml file by replacing the uuid with the one that identifies the existing layer in the db.
Does a more stable solution exist, rather than having to apply this workaround?

@gannebamm
Copy link

We ran into the same 'issue'. Some of our datasets are uploads from different years which will share 90% of there metadata. We have overridden the above mentioned error and allowing our users to upload an metadata xml over a new dataset. It will drop the xmls uuid and using the one from the geonode dataset instead but uses the xmls metadata from other fields. Additionally a warning will be displayed on upload.
I am not sure if the above behaviour is wanted in upstream. If there are many users who would like to re-use metadata from other datasets we could share it as pull request.

@ardean80
Copy link
Author

Glad to know I'm not alone. :D
I tested another workaround: you can also remove the UUID from the metadata xml (the gmd:fileIdentifier tag). In this way the upload succeeds, without the need to modify in the code.
Anyway, it could be useful either to not exporting at all the UUID in the xml or at least give the user the option to do it or, on the other side, to force the upload (by warning the user first).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants