[Geoserver-users] Extracting contours (gs:Contour) on binary images

Hi,

I've been using the gs:Contour WPS process for extracting contour on Float
images and it works perfectly.

But now that i'm trying to extract only one contour from an input image
(which is stored as Byte and only contain two values, 0 and 1), I seem to
have some difficulties understanding the "Why is it not working ?"

At first, I tried creating the appropriate SLD with only one level defined
(like below)

            <ogc:Function name="parameter">
              <ogc:Literal>levels</ogc:Literal>
              <ogc:Literal>1.0</ogc:Literal>
            </ogc:Function>

but I get the following exception on GeoServer side :

Caused by: java.security.InvalidParameterException: Could not convert the
value 1.0 into the expected type double for parameter levels

I don't know why this exception is thrown but I guess it disappear when I
add another level :

            <ogc:Function name="parameter">
              <ogc:Literal>levels</ogc:Literal>
              <ogc:Literal>0.0</ogc:Literal>
              <ogc:Literal>1.0</ogc:Literal>
            </ogc:Function>

This way, no exception is thrown but a visual result that is really not what
I was expecting. See for yourself :

Layer with simple style (orange is 1) :
<http://osgeo-org.1560.x6.nabble.com/file/n5210483/1.png&gt;

Layer with contour style as described above (levels 0.0 and 1.0) :
<http://osgeo-org.1560.x6.nabble.com/file/n5210483/2.png&gt;

When zooming in, the levels values appears on the map and as you can see, I
only have contours for level 1.0 :
<http://osgeo-org.1560.x6.nabble.com/file/n5210483/3.png&gt;

I tried simplify or smooth parameters hoping that it would change the result
but no luck.
I also tried specifying intervals instead of levels : it create the exact
same output as in the screenshots above.

So here is my question : is it possible to extract only 1 contour on a
binary image ? If it is, please tell me how...

Thanks for your consideration,

Cyril

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Extracting-contours-gs-Contour-on-binary-images-tp5210483.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

On Thu, Jun 11, 2015 at 9:47 PM, CGA <cgallay.artal@anonymised.com> wrote:

Hi,

I've been using the gs:Contour WPS process for extracting contour on Float
images and it works perfectly.

But now that i'm trying to extract only one contour from an input image
(which is stored as Byte and only contain two values, 0 and 1), I seem to
have some difficulties understanding the "Why is it not working ?"

At first, I tried creating the appropriate SLD with only one level defined
(like below)

            <ogc:Function name="parameter">
              <ogc:Literal>levels</ogc:Literal>
              <ogc:Literal>1.0</ogc:Literal>
            </ogc:Function>

but I get the following exception on GeoServer side :

Caused by: java.security.InvalidParameterException: Could not convert the
value 1.0 into the expected type double for parameter levels

I don't know why this exception is thrown but I guess it disappear when I
add another level :

Interesting, this one should be easily fixed, could you open a ticket at
https://osgeo-org.atlassian.net/projects/GEOS

            <ogc:Function name="parameter">
              <ogc:Literal>levels</ogc:Literal>
              <ogc:Literal>0.0</ogc:Literal>
              <ogc:Literal>1.0</ogc:Literal>
            </ogc:Function>

This way, no exception is thrown but a visual result that is really not
what
I was expecting. See for yourself :

Layer with simple style (orange is 1) :
<http://osgeo-org.1560.x6.nabble.com/file/n5210483/1.png&gt;

Layer with contour style as described above (levels 0.0 and 1.0) :
<http://osgeo-org.1560.x6.nabble.com/file/n5210483/2.png&gt;

When zooming in, the levels values appears on the map and as you can see, I
only have contours for level 1.0 :
<http://osgeo-org.1560.x6.nabble.com/file/n5210483/3.png&gt;

I tried simplify or smooth parameters hoping that it would change the
result
but no luck.
I also tried specifying intervals instead of levels : it create the exact
same output as in the screenshots above.

This one is a known issue, the algorithm does that in flat areas:
https://osgeo-org.atlassian.net/browse/GEOT-4069

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 Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
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.

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