[Geoserver-users] Update layer keywords programmatically

Hi there,

I am currently searchning for a way to update ca. 280 layers with new keywords. The reason I would like to do this is to be able to harvest the getcapabilities documents of the services and set up a services catalog.

After googling it for a while and searching the users group the only post that comes anywhere near is from 2011:

http://osgeo-org.1560.x6.nabble.com/automating-layer-metadata-update-td3790274.html

Naturally the obvious choice would be to use the REST API to update the layer using the /layers/{layerName} endpoint with a POST, but I am not sure if this is possible for keywords.

Does anybody have any experiance with this endpoint ? and can share some wisdom on how to update layers keywords via the REST API (if at all possible…)

If the REST API endpoint is not a possibility is there maybe another way I can do it programmatically?

Thanks in advance

Met vriendelijke groet,

Itay Bar-On
Geo Informatie Specialist

Gemeente Vlaardingen

Informatie en Facilitaire Voorzieningen
Westnieuwland 6, 3131VX Vlaardingen, Nederland

T 06 10173309
E Itay.BarOn@anonymised.com
W www.vlaardingen.nl

Hi,

I don’t know about the REST API but a few years ago for some obscure reason I needed to move a whole bunch of layer definitions from one workspace (id) to another. Cooked a quick python script for that (https://gist.github.com/tkardi/97ef9bc6b0cde411bfb85feccdb9b7ed). It will not suite your exact needs but most probably as a general idea it would still hold.

The very fine print in bold letters: Do pay attention: this approach is an absolutely sure way of messing up the whole datastore - that is basically breaking all your geoserver services. So caution is advised (and a backup of your data dir).

The REST API solution would be the correct solution here but if all else fails and you feel like walking on the edge then … :slight_smile:

All the best,
(and sorry for the bad advice)
Tõnis

image001.gif

···

@tkardi

Hi there,

I am currently searchning for a way to update ca. 280 layers with new keywords. The reason I would like to do this is to be able to harvest the getcapabilities documents of the services and set up a services catalog.

After googling it for a while and searching the users group the only post that comes anywhere near is from 2011:

http://osgeo-org.1560.x6.nabble.com/automating-layer-metadata-update-td3790274.html

Naturally the obvious choice would be to use the REST API to update the layer using the /layers/{layerName} endpoint with a POST, but I am not sure if this is possible for keywords.

Does anybody have any experiance with this endpoint ? and can share some wisdom on how to update layers keywords via the REST API (if at all possible…)

If the REST API endpoint is not a possibility is there maybe another way I can do it programmatically?

Thanks in advance

Met vriendelijke groet,

Itay Bar-On
Geo Informatie Specialist

Gemeente Vlaardingen

Informatie en Facilitaire Voorzieningen
Westnieuwland 6, 3131VX Vlaardingen, Nederland

T 06 10173309
E Itay.BarOn@anonymised.com
W www.vlaardingen.nl

Hi,

Thanks for your answer….this is a very risky approach J and I rather not use it unless all else fails…luckily it seems that the REST API is suitable!

Regards,

Itay

Verzonden: maandag 3 juni 2019 14:23

image001.gif

···

Hi,

I don’t know about the REST API but a few years ago for some obscure reason I needed to move a whole bunch of layer definitions from one workspace (id) to another. Cooked a quick python script for that (https://gist.github.com/tkardi/97ef9bc6b0cde411bfb85feccdb9b7ed). It will not suite your exact needs but most probably as a general idea it would still hold.

The very fine print in bold letters: Do pay attention: this approach is an absolutely sure way of messing up the whole datastore - that is basically breaking all your geoserver services. So caution is advised (and a backup of your data dir).

The REST API solution would be the correct solution here but if all else fails and you feel like walking on the edge then … :slight_smile:

All the best,

(and sorry for the bad advice)

Tõnis

@tkardi

Kontakt Bar-On, Itay (<Itay.BarOn@…9729…>) kirjutas kuupäeval E, 3. juuni 2019 kell 14:37:

Hi there,

I am currently searchning for a way to update ca. 280 layers with new keywords. The reason I would like to do this is to be able to harvest the getcapabilities documents of the services and set up a services catalog.

After googling it for a while and searching the users group the only post that comes anywhere near is from 2011:

http://osgeo-org.1560.x6.nabble.com/automating-layer-metadata-update-td3790274.html

Naturally the obvious choice would be to use the REST API to update the layer using the /layers/{layerName} endpoint with a POST, but I am not sure if this is possible for keywords.

Does anybody have any experiance with this endpoint ? and can share some wisdom on how to update layers keywords via the REST API (if at all possible…)

If the REST API endpoint is not a possibility is there maybe another way I can do it programmatically?

Thanks in advance

Met vriendelijke groet,

Itay Bar-On
Geo Informatie Specialist

Gemeente Vlaardingen

Informatie en Facilitaire Voorzieningen
Westnieuwland 6, 3131VX Vlaardingen, Nederland

T 06 10173309
E Itay.BarOn@…9729…
W www.vlaardingen.nl

De gemeente Vlaardingen stuurt privacygevoelige e-mail berichten via een beveiligde verbinding van KPN Zorg Messenger. Meer informatie vindt u op www.vlaardingen.nl/veiligmailen.


Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:

If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer

Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Hi,

Thanks for sharing this, I will try it out but first let me see if I understand it correctly:

To add new keywords I just add a new tag with the corresponding value e.i. newKeyword, in the upload body, do I need to mention the existing keywords? And if I omit them will they be deleted (what I actually also need)?

Regards,

Itay

image001.gif

···

Van: Nuno Oliveira [mailto:nuno.oliveira@…1107…]
Verzonden: maandag 3 juni 2019 15:14
Aan: Bar-On, Itay; geoserver-users@lists.sourceforge.net
Onderwerp: Re: [Geoserver-users] Update layer keywords programmatically

Hi,

Yes you can from the featureTypes end point (https://docs.geoserver.org/latest/en/api/#/latest/en/api/1.0.0/featuretypes.yaml):

geoserver/rest/workspaces/{workspace}/datastores/{dataStore}/featuretypes/{featureType}.xml

The POST content should look like this (for updating keywords only):

features

facility

newKeyword

Best regards,

Nuno Oliveira

On Mon, 2019-06-03 at 10:59 +0000, Bar-On, Itay wrote:

Hi there,

I am currently searchning for a way to update ca. 280 layers with new keywords. The reason I would like to do this is to be able to harvest the getcapabilities documents of the services and set up a services catalog.

After googling it for a while and searching the users group the only post that comes anywhere near is from 2011:

http://osgeo-org.1560.x6.nabble.com/automating-layer-metadata-update-td3790274.html

Naturally the obvious choice would be to use the REST API to update the layer using the /layers/{layerName} endpoint with a POST, but I am not sure if this is possible for keywords.

Does anybody have any experiance with this endpoint ? and can share some wisdom on how to update layers keywords via the REST API (if at all possible…)

If the REST API endpoint is not a possibility is there maybe another way I can do it programmatically?

Thanks in advance

Met vriendelijke groet,

Itay Bar-On
Geo Informatie Specialist

Gemeente Vlaardingen

Informatie en Facilitaire Voorzieningen
Westnieuwland 6, 3131VX Vlaardingen, Nederland

T 06 10173309
E Itay.BarOn@…9729…
W www.vlaardingen.nl

De gemeente Vlaardingen stuurt privacygevoelige e-mail berichten via een beveiligde verbinding van KPN Zorg Messenger. Meer informatie vindt u op www.vlaardingen.nl/veiligmailen.

_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:
- Earning your support instead of buying it, but Ian Turton: [http://www.ianturton.com/talks/foss4g.html#/](http://www.ianturton.com/talks/foss4g.html#/)
- The GeoServer user list posting guidelines: [http://geoserver.org/comm/userlist-guidelines.html](http://geoserver.org/comm/userlist-guidelines.html)

If you want to request a feature or an improvement, also see this: [https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer](https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer)


[Geoserver-users@lists.sourceforge.net](mailto:Geoserver-users@lists.sourceforge.net)
[https://lists.sourceforge.net/lists/listinfo/geoserver-users](https://lists.sourceforge.net/lists/listinfo/geoserver-users)
-- 
Regards,
Nuno Oliveira
==
GeoServer Professional Services from the
experts! 
Visit http://goo.gl/it488V for more information.
==

Nuno Miguel Carvalho Oliveira
@nmcoliveira
Software Engineer

GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax:      +39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

Con riferimento alla normativa sul trattamento dei dati 
personali (Reg. UE 2016/679 - Regolamento generale sulla 
protezione dei dati “GDPR”), si precisa che ogni 
circostanza inerente alla presente email (il suo contenuto, 
gli eventuali allegati, etc.) è un dato la cui conoscenza 
è riservata al/i solo/i destinatario/i indicati dallo 
scrivente. Se il messaggio Le è giunto per errore, è 
tenuta/o a cancellarlo, ogni altra operazione è illecita. 
Le sarei comunque grato se potesse darmene notizia.

This email is intended only for the person or entity to 
which it is addressed and may contain information that 
is privileged, confidential or otherwise protected from 
disclosure. We remind that - as provided by European 
Regulation 2016/679 “GDPR” - copying, dissemination or 
use of this e-mail or the information herein by anyone 
other than the intended recipient is prohibited. If you 
have received this email by mistake, please notify 
us immediately by telephone or e-mail.

Hi,

Thanks for sharing this, I will try it out but first let me see if I understand it correctly:

To add new keywords I just add a new tag with the corresponding value e.i. newKeyword, in the upload body, do I need to mention the existing keywords? And if I omit them will they be deleted (what I actually also need)?

Regards,

Itay

image001.gif

···

Van: Nuno Oliveira [mailto:nuno.oliveira@anonymised.com]
Verzonden: maandag 3 juni 2019 15:14
Aan: Bar-On, Itay; geoserver-users@lists.sourceforge.net
Onderwerp: Re: [Geoserver-users] Update layer keywords programmatically

Hi,

Yes you can from the featureTypes end point (https://docs.geoserver.org/latest/en/api/#/latest/en/api/1.0.0/featuretypes.yaml):

geoserver/rest/workspaces/{workspace}/datastores/{dataStore}/featuretypes/{featureType}.xml

The POST content should look like this (for updating keywords only):

features

facility

newKeyword

Best regards,

Nuno Oliveira

On Mon, 2019-06-03 at 10:59 +0000, Bar-On, Itay wrote:

Hi there,

I am currently searchning for a way to update ca. 280 layers with new keywords. The reason I would like to do this is to be able to harvest the getcapabilities documents of the services and set up a services catalog.

After googling it for a while and searching the users group the only post that comes anywhere near is from 2011:

http://osgeo-org.1560.x6.nabble.com/automating-layer-metadata-update-td3790274.html

Naturally the obvious choice would be to use the REST API to update the layer using the /layers/{layerName} endpoint with a POST, but I am not sure if this is possible for keywords.

Does anybody have any experiance with this endpoint ? and can share some wisdom on how to update layers keywords via the REST API (if at all possible…)

If the REST API endpoint is not a possibility is there maybe another way I can do it programmatically?

Thanks in advance

Met vriendelijke groet,

Itay Bar-On
Geo Informatie Specialist

Gemeente Vlaardingen

Informatie en Facilitaire Voorzieningen
Westnieuwland 6, 3131VX Vlaardingen, Nederland

T 06 10173309
E Itay.BarOn@anonymised.com
W www.vlaardingen.nl

De gemeente Vlaardingen stuurt privacygevoelige e-mail berichten via een beveiligde verbinding van KPN Zorg Messenger. Meer informatie vindt u op www.vlaardingen.nl/veiligmailen.

_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:
- Earning your support instead of buying it, but Ian Turton: [http://www.ianturton.com/talks/foss4g.html#/](http://www.ianturton.com/talks/foss4g.html#/)
- The GeoServer user list posting guidelines: [http://geoserver.org/comm/userlist-guidelines.html](http://geoserver.org/comm/userlist-guidelines.html)

If you want to request a feature or an improvement, also see this: [https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer](https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer)


[Geoserver-users@lists.sourceforge.net](mailto:Geoserver-users@lists.sourceforge.net)
[https://lists.sourceforge.net/lists/listinfo/geoserver-users](https://lists.sourceforge.net/lists/listinfo/geoserver-users)
-- 
Regards,
Nuno Oliveira
==
GeoServer Professional Services from the
experts! 
Visit http://goo.gl/it488V for more information.
==

Nuno Miguel Carvalho Oliveira
@nmcoliveira
Software Engineer

GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax:      +39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

Con riferimento alla normativa sul trattamento dei dati 
personali (Reg. UE 2016/679 - Regolamento generale sulla 
protezione dei dati “GDPR”), si precisa che ogni 
circostanza inerente alla presente email (il suo contenuto, 
gli eventuali allegati, etc.) è un dato la cui conoscenza 
è riservata al/i solo/i destinatario/i indicati dallo 
scrivente. Se il messaggio Le è giunto per errore, è 
tenuta/o a cancellarlo, ogni altra operazione è illecita. 
Le sarei comunque grato se potesse darmene notizia.

This email is intended only for the person or entity to 
which it is addressed and may contain information that 
is privileged, confidential or otherwise protected from 
disclosure. We remind that - as provided by European 
Regulation 2016/679 “GDPR” - copying, dissemination or 
use of this e-mail or the information herein by anyone 
other than the intended recipient is prohibited. If you 
have received this email by mistake, please notify 
us immediately by telephone or e-mail.

Hi,

Your memory did serve you well and you are correct new keywords are added and existing ones are deleted when omitted.

Thanks for your help.

Regards,

Itay

image001.gif

···

Van: Nuno Oliveira [mailto:nuno.oliveira@…1107…]
Verzonden: maandag 3 juni 2019 16:00
Aan: Bar-On, Itay; geoserver-users@lists.sourceforge.net
Onderwerp: Re: [Geoserver-users] Update layer keywords programmatically

Hi,

If my memory serves me well, you need to put there the keyword you want to have, so new ones will be added and missing existing ones will be deleted.

You should give it a try, this is an easy check.

Regards,

On Mon, 2019-06-03 at 13:44 +0000, Bar-On, Itay wrote:

Hi,

Thanks for sharing this, I will try it out but first let me see if I understand it correctly:

To add new keywords I just add a new tag with the corresponding value e.i. newKeyword, in the upload body, do I need to mention the existing keywords? And if I omit them will they be deleted (what I actually also need)?

Regards,

Itay

Van: Nuno Oliveira [mailto:nuno.oliveira@…1107…]
Verzonden: maandag 3 juni 2019 15:14
Aan: Bar-On, Itay; geoserver-users@lists.sourceforge.net
Onderwerp: Re: [Geoserver-users] Update layer keywords programmatically

Hi,

Yes you can from the featureTypes end point (https://docs.geoserver.org/latest/en/api/#/latest/en/api/1.0.0/featuretypes.yaml):

geoserver/rest/workspaces/{workspace}/datastores/{dataStore}/featuretypes/{featureType}.xml

The POST content should look like this (for updating keywords only):

features

facility

newKeyword

Best regards,

Nuno Oliveira

On Mon, 2019-06-03 at 10:59 +0000, Bar-On, Itay wrote:

Hi there,

I am currently searchning for a way to update ca. 280 layers with new keywords. The reason I would like to do this is to be able to harvest the getcapabilities documents of the services and set up a services catalog.

After googling it for a while and searching the users group the only post that comes anywhere near is from 2011:

http://osgeo-org.1560.x6.nabble.com/automating-layer-metadata-update-td3790274.html

Naturally the obvious choice would be to use the REST API to update the layer using the /layers/{layerName} endpoint with a POST, but I am not sure if this is possible for keywords.

Does anybody have any experiance with this endpoint ? and can share some wisdom on how to update layers keywords via the REST API (if at all possible…)

If the REST API endpoint is not a possibility is there maybe another way I can do it programmatically?

Thanks in advance

Met vriendelijke groet,

Itay Bar-On
Geo Informatie Specialist

Gemeente Vlaardingen

Informatie en Facilitaire Voorzieningen
Westnieuwland 6, 3131VX Vlaardingen, Nederland

T 06 10173309
E Itay.BarOn@…9729…
W www.vlaardingen.nl

De gemeente Vlaardingen stuurt privacygevoelige e-mail berichten via een beveiligde verbinding van KPN Zorg Messenger. Meer informatie vindt u op www.vlaardingen.nl/veiligmailen.

_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:
- Earning your support instead of buying it, but Ian Turton: [http://www.ianturton.com/talks/foss4g.html#/](http://www.ianturton.com/talks/foss4g.html#/)
- The GeoServer user list posting guidelines: [http://geoserver.org/comm/userlist-guidelines.html](http://geoserver.org/comm/userlist-guidelines.html)

If you want to request a feature or an improvement, also see this: [https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer](https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer)


[Geoserver-users@lists.sourceforge.net](mailto:Geoserver-users@lists.sourceforge.net)
[https://lists.sourceforge.net/lists/listinfo/geoserver-users](https://lists.sourceforge.net/lists/listinfo/geoserver-users)
-- 
Regards,
Nuno Oliveira
==
GeoServer Professional Services from the
experts! 
Visit http://goo.gl/it488V for more information.
==

Nuno Miguel Carvalho Oliveira
@nmcoliveira
Software Engineer

GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax:      +39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

Con riferimento alla normativa sul trattamento dei dati 
personali (Reg. UE 2016/679 - Regolamento generale sulla 
protezione dei dati “GDPR”), si precisa che ogni 
circostanza inerente alla presente email (il suo contenuto, 
gli eventuali allegati, etc.) è un dato la cui conoscenza 
è riservata al/i solo/i destinatario/i indicati dallo 
scrivente. Se il messaggio Le è giunto per errore, è 
tenuta/o a cancellarlo, ogni altra operazione è illecita. 
Le sarei comunque grato se potesse darmene notizia.

This email is intended only for the person or entity to 
which it is addressed and may contain information that 
is privileged, confidential or otherwise protected from 
disclosure. We remind that - as provided by European 
Regulation 2016/679 “GDPR” - copying, dissemination or 
use of this e-mail or the information herein by anyone 
other than the intended recipient is prohibited. If you 
have received this email by mistake, please notify 
us immediately by telephone or e-mail.
-- 
Regards,
Nuno Oliveira
==
GeoServer Professional Services from the
experts! 
Visit http://goo.gl/it488V for more information.
==

Nuno Miguel Carvalho Oliveira
@nmcoliveira
Software Engineer

GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax:      +39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

Con riferimento alla normativa sul trattamento dei dati 
personali (Reg. UE 2016/679 - Regolamento generale sulla 
protezione dei dati “GDPR”), si precisa che ogni 
circostanza inerente alla presente email (il suo contenuto, 
gli eventuali allegati, etc.) è un dato la cui conoscenza 
è riservata al/i solo/i destinatario/i indicati dallo 
scrivente. Se il messaggio Le è giunto per errore, è 
tenuta/o a cancellarlo, ogni altra operazione è illecita. 
Le sarei comunque grato se potesse darmene notizia.

This email is intended only for the person or entity to 
which it is addressed and may contain information that 
is privileged, confidential or otherwise protected from 
disclosure. We remind that - as provided by European 
Regulation 2016/679 “GDPR” - copying, dissemination or 
use of this e-mail or the information herein by anyone 
other than the intended recipient is prohibited. If you 
have received this email by mistake, please notify 
us immediately by telephone or e-mail.