[Geoserver-users] Setting InputTransparentColor from code

Hi all,

I'm new to GeoServer and I have a problem that I couldn't solved:

I'm creating a GeoTiff layer (creating CoverageStore + Coverage) via C# code
that wrapps REST APIs.
At the layer I also add the InputTransparentColor field with color value for
the GeoTiff to be transparent.

Everything seems to be created correctly. I see The layer and all its
fields, but when I look at the layer preview (and also in my UI client), the
GeoTiff image is not transparent.

IF I enter MANUALLY to the Edit Layer page of the GeoServer, and only press
the 'Save' button there, without changing anything, suddenly the image
becomes transparent.

I must create the layesrs automatically via code, and I can't enter manually
to the GeoServer to save.

What can I do via the code to resemble the manuall save?
How can I get the image to becomes transparent via the code / rest?

Thanks,
Revital.

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Setting-InputTransparentColor-from-code-tp5252205.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

On Tue, Feb 23, 2016 at 1:20 PM, RSaulkin <rsaulkin@anonymised.com> wrote:

IF I enter MANUALLY to the Edit Layer page of the GeoServer, and only press
the 'Save' button there, without changing anything, suddenly the image
becomes transparent.

Generally speaking, anything that you can do manually in the GUI should
also be doable
with the REST API.
To discover how, check the coverage REST representation before manually
changing
the transparency, then change it via the GUI, go back and check again the
REST
representation: this should make it evident what you have to PUT in the
resource by code

Cheers
Andrea

--

GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

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

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

*AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*

Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.

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

Thanks for you reply.

Maybe it's a silly question, but how can I check the coverage REST
representation?

Thanks a lot,
Revital.

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Setting-InputTransparentColor-from-code-tp5252205p5252894.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

On Thu, Feb 25, 2016 at 6:07 PM, RSaulkin <rsaulkin@anonymised.com> wrote:

Thanks for you reply.

Maybe it's a silly question, but how can I check the coverage REST
representation?

You did not check out user guide I assume?
http://docs.geoserver.org/latest/en/user/rest/index.html#rest

(or just googling "coverage rest geoserver", the answer is in the first two
results...)

Cheers
Andrea

--

GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

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

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

*AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*

Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.

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

I actually read it, more than once :slight_smile:
But still couldn't fully understand how to do it (I'm new to REST not just
to the GeoServer).

But eventually I succeeded doing so, and you were right! I found the
difference.

The difference was that I entered the color from the code, as Hex number,
with no # before.
Apparently for the GeoServer to recognize the color for transparency it has
to be in the following pattern: #FFFFFF (makes sense since it is hex).
In the GUI of the GeoServer it looks the same, (without #) so I couldn't
understand the difference.

Thanks a lot!
Revital.

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Setting-InputTransparentColor-from-code-tp5252205p5252906.html
Sent from the GeoServer - User mailing list archive at Nabble.com.