[GeoNode-users] Metadata Import with PyCSW

Jonáš Veselka jonas.veselka at gisat.cz
Wed Sep 23 06:47:00 PDT 2015

OK, here it is. It's long and dirty code, but main points are:

87: __init__: some connections, SQL query for metadata from old GeoNode

130: gnode: GET geonode to get csrf token, then POST to login to get

191: getContacts: not important, I used it to construct SQL query to update

284: copy: main method, which gets values and make POST request.

So, You asked for it :-) But I hope it will be helpful. I apologize for any
non-english comments. If You have any question, ask me.


2015-09-23 14:12 GMT+02:00 Ariel Nunez <ingenieroariel at gmail.com>:

> Jonas,
> I would be very interested to check out the script.
> Thanks for the offer,
> Ariel.
> On Wed, Sep 23, 2015 at 6:47 AM, Jonáš Veselka <jonas.veselka at gisat.cz>
> wrote:
>> Dear Ariel and others,
>> two months ago, I asked You to help with my task to move metadata from
>> GeoNode 1.2 to GeoNode 2.4. You have posted some good advices, that pushed
>> me, but I didn't manage to do it that way.
>> I'am sorry, I didn't respond anymore. After trying many dead ends, I
>> finaly moved metadata by writing a python script to simulate POST requests
>> of GeoNode metadata form, for each layer. It is very specific for our needs
>> (some fields are constant, some are omitted), but if anyone is fighting
>> this issue, I can post the script.
>> Thanks,
>> Jonáš
>> 2015-07-22 18:06 GMT+02:00 Ariel Nunez <ingenieroariel at gmail.com>:
>>> Jonas,
>>> I think you can do something like this:
>>> first type: python manage.py shell
>>> and then try to replicate the following lines with the information in
>>> the xml field:
>>> https://github.com/GeoNode/geonode/blob/master/geonode/layers/utils.py#L425
>>> The basic idea is to iterate over the values, set them in the model and
>>> then save.
>>> -a
>>> On Wed, Jul 22, 2015 at 9:25 AM, Jonáš Veselka <jonas.veselka at gisat.cz>
>>> wrote:
>>>> Hi,
>>>> I'm trying to find out how to import metadata.
>>>> I'm using GeoNode 2.4b24 with built-in PyCSW. I need to transfer
>>>> metadata from an old app on GeoNode 1.2 and GeoNetwork.
>>>> I was thinking about and trying many ways but it always was too
>>>> complicated or somehow impossible. Until I've got an advice from Ariel
>>>> Núñez to place whole XML contents in the field *metadata_xml*, set
>>>> *metadata_uploaded* to true and call PyCSW internals. But how and what
>>>> to call to redistribute metadata in proper places?
>>>> I tried to call *geonode updatelayers -f name_of_the_layer* but it
>>>> didn't change anything.
>>>> _______________________________________________
>>>> geonode-users mailing list
>>>> geonode-users at lists.osgeo.org
>>>> http://lists.osgeo.org/cgi-bin/mailman/listinfo/geonode-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geonode-users/attachments/20150923/f1091a44/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Meta3data-public.py
Type: application/octet-stream
Size: 15306 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/geonode-users/attachments/20150923/f1091a44/attachment-0001.obj>

More information about the geonode-users mailing list