Hi Jody and Andrea,

Yes, after I wrote the email I discovered the gs:Transform in WPS, and what
a lovely thing it is. All in all, I've finally managed to get 2 foot
contours from the Oklahoma NRCS LiDAR 2m DEM coverage to come out in all
the output formats I already had in WFS. I use the chain WCS -> gs:Contour
-> gs:Transform -> gs:Import to create a new PostGIS layer, then WFS with
OGR2OGR to get all the output formats needed (SHP, KML, TAB, DGN, CSV,
DXF). Then delete the PostGIS layer and the underlying table.

It would be nice to skip the last step of creating the PostGIS layer and
WFS and go directly to OGR2OGR, but this doesn't seem possible at this time.

One more thing, I discovered that gs:Import seems to strip all significant
digits after 2. ie, 3.14159 turns into 3.140000. Is this a bug or a feature?

As an example for anyone else contemplating such a thing, here is the WPS
XML for the chain:

<wps:Execute version="1.0.0" service="WPS" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"; xmlns="
http://www.opengis.net/wps/1.0.0"; xmlns:wps="
http://www.opengis.net/wps/1.0.0"; xmlns:xlink="http://www.w3.org/1999/xlink
" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0
http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd"; xmlns:wcs="
http://www.opengis.net/wcs/1.1.1"; xmlns:ogc="http://www.opengis.net/ogc
" xmlns:gml="http://www.opengis.net/gml"; xmlns:ows="
http://www.opengis.net/ows/1.1"; xmlns:wfs="http://www.opengis.net/wfs";>
  <ows:Identifier>gs:Import</ows:Identifier>
  <wps:DataInputs>
    <wps:Input>
      <ows:Identifier>features</ows:Identifier>
      <wps:Reference mimeType="text/xml" xlink:href="http://geoserver/wps
" method="POST">
        <wps:Body>

          <wps:Execute version="1.0.0" service="WPS" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"; xmlns="
http://www.opengis.net/wps/1.0.0"; xmlns:wfs="http://www.opengis.net/wfs
" xmlns:wps="http://www.opengis.net/wps/1.0.0"; xmlns:ows="
http://www.opengis.net/ows/1.1"; xmlns:gml="http://www.opengis.net/gml
" xmlns:ogc="http://www.opengis.net/ogc"; xmlns:wcs="
http://www.opengis.net/wcs/1.1.1"; xmlns:xlink="http://www.w3.org/1999/xlink
" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0
http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd";>
            <ows:Identifier>gs:Transform</ows:Identifier>
            <wps:DataInputs>
              <wps:Input>
                <ows:Identifier>features</ows:Identifier>
                <wps:Reference mimeType="text/xml" xlink:href="
http://geoserver/wps"; method="POST">
                  <wps:Body>


                    <wps:Execute version="1.0.0" service="WPS" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"; xmlns="
http://www.opengis.net/wps/1.0.0"; xmlns:wps="
http://www.opengis.net/wps/1.0.0"; xmlns:xlink="http://www.w3.org/1999/xlink
" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0
http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd";>
                      <ows:Identifier>gs:Contour</ows:Identifier>
                      <wps:DataInputs>
                        <wps:Input>
                          <ows:Identifier>data</ows:Identifier>
                          <wps:Reference mimeType="image/tiff" xlink:href="
http://geoserver/wcs"; method="POST">
                            <wps:Body>

  <GetCoverage version="1.0.0" service="WCS" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"; xmlns="http://www.opengis.net/wcs
" xsi:schemaLocation="http://www.opengis.net/wcs
http://schemas.opengis.net/wcs/1.0.0/getCoverage.xsd";>

  <sourceCoverage>ogi_lidar:NRCS_DEM_BARE_EARTH</sourceCoverage>
                                <domainSubset>
                                  <spatialSubset>
                                    <gml:Envelope srsName="EPSG:4326">
                                      <gml:pos>-96.0687156617757
35.1255642992251</gml:pos>
                                      <gml:pos>-96.0642402362548
35.1284724716978</gml:pos>
                                    </gml:Envelope>
                                    <gml:Grid dimension="2">
                                      <gml:limits>
                                        <gml:GridEnvelope>
                                          <gml:low>0 0</gml:low>
                                          <gml:high>249 162</gml:high>
                                        </gml:GridEnvelope>
                                      </gml:limits>
                                      <gml:axisName>x</gml:axisName>
                                      <gml:axisName>y</gml:axisName>
                                    </gml:Grid>
                                  </spatialSubset>
                                </domainSubset>
                                <output>
                                  <crs>EPSG:3785</crs>
                                  <format>GeoTIFF</format>
                                </output>
                              </GetCoverage>
                            </wps:Body>
                          </wps:Reference>
                        </wps:Input>
                        <wps:Input>
                          <ows:Identifier>band</ows:Identifier>
                          <wps:Data>
                            <wps:LiteralData>Grey_Index</wps:LiteralData>
                          </wps:Data>
                        </wps:Input>
                        <wps:Input>
                          <ows:Identifier>interval</ows:Identifier>
                          <wps:Data>
                            <wps:LiteralData>0.6096</wps:LiteralData>
                          </wps:Data>
                        </wps:Input>
                      </wps:DataInputs>
                      <wps:ResponseForm>
                        <wps:RawDataOutput mimeType="text/xml;
subtype=wfs-collection/1.0">
                          <ows:Identifier>result</ows:Identifier>
                        </wps:RawDataOutput>
                      </wps:ResponseForm>
                    </wps:Execute>
                  </wps:Body>
                </wps:Reference>
              </wps:Input>
              <wps:Input>
                <ows:Identifier>transform</ows:Identifier>
                <wps:Data>
                  <wps:LiteralData>the_geom=the_geom;
value=round(value*3.28084)</wps:LiteralData>
                </wps:Data>
              </wps:Input>
            </wps:DataInputs>
            <wps:ResponseForm>
              <wps:RawDataOutput mimeType="text/xml;
subtype=wfs-collection/1.0">
                <ows:Identifier>result</ows:Identifier>
              </wps:RawDataOutput>
            </wps:ResponseForm>
          </wps:Execute>
        </wps:Body>
      </wps:Reference>
    </wps:Input>
    <wps:Input>
      <ows:Identifier>workspace</ows:Identifier>
      <wps:Data>
        <wps:LiteralData>ogi</wps:LiteralData>
      </wps:Data>
    </wps:Input>
    <wps:Input>
      <ows:Identifier>store</ows:Identifier>
      <wps:Data>
        <wps:LiteralData>CS_USBND</wps:LiteralData>
      </wps:Data>
    </wps:Input>
    <wps:Input>
      <ows:Identifier>name</ows:Identifier>
      <wps:Data>
        <wps:LiteralData>TempClipTable555</wps:LiteralData>
      </wps:Data>
    </wps:Input>
    <wps:Input>
      <ows:Identifier>srs</ows:Identifier>
      <wps:Data>
        <wps:LiteralData>EPSG:4326</wps:LiteralData>
      </wps:Data>
    </wps:Input>
    <wps:Input>
      <ows:Identifier>srsHandling</ows:Identifier>
      <wps:Data>
        <wps:LiteralData>REPROJECT_TO_DECLARED</wps:LiteralData>
      </wps:Data>
    </wps:Input>
  </wps:DataInputs>
  <wps:ResponseForm>
    <wps:RawDataOutput>
      <ows:Identifier>layerName</ows:Identifier>
    </wps:RawDataOutput>
  </wps:ResponseForm>
</wps:Execute>



On Thu, May 29, 2014 at 4:14 AM, Jody Garnett <jody.garn...@gmail.com>wrote:

> I thought transform was already listed for WPS?
>
> Yep here it is:
>
> *vec:Transform*
> Computes a new feature collection from the input one by renaming,
> deleting, and computing new attributes. Attribute values are specified as
> ECQL expressions in the form name=expression.
>
> Combined with:
> http://docs.geoserver.org/stable/en/user/filter/function_reference.html
>
> I was able to execute using:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <wps:Execute version="1.0.0" service="WPS" xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance"; xmlns="
> http://www.opengis.net/wps/1.0.0"; xmlns:wfs="http://www.opengis.net/wfs";
> xmlns:wps="http://www.opengis.net/wps/1.0.0"; xmlns:ows="
> http://www.opengis.net/ows/1.1"; xmlns:gml="http://www.opengis.net/gml";
> xmlns:ogc="http://www.opengis.net/ogc"; xmlns:wcs="
> http://www.opengis.net/wcs/1.1.1"; xmlns:xlink="
> http://www.w3.org/1999/xlink"; xsi:schemaLocation="
> http://www.opengis.net/wps/1.0.0
> http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd";>
>   <ows:Identifier>vec:Transform</ows:Identifier>
>   <wps:DataInputs>
>     <wps:Input>
>       <ows:Identifier>features</ows:Identifier>
>       <wps:Reference mimeType="text/xml" xlink:href="http://geoserver/wfs";
> method="POST">
>         <wps:Body>
>           <wfs:GetFeature service="WFS" version="1.0.0"
> outputFormat="GML2" xmlns:topp="http://www.openplans.org/topp";>
>             <wfs:Query typeName="topp:states"/>
>           </wfs:GetFeature>
>         </wps:Body>
>       </wps:Reference>
>     </wps:Input>
>     <wps:Input>
>       <ows:Identifier>transform</ows:Identifier>
>       <wps:Data>
>
> <wps:LiteralData>the_geom=centroid(the_geom);LAND_MILES=LAND_KM*0.386102</wps:LiteralData>
>       </wps:Data>
>     </wps:Input>
>   </wps:DataInputs>
>   <wps:ResponseForm>
>     <wps:RawDataOutput mimeType="text/xml; subtype=wfs-collection/1.0">
>       <ows:Identifier>result</ows:Identifier>
>     </wps:RawDataOutput>
>   </wps:ResponseForm>
> </wps:Execute>
>
>
>
>
> Jody Garnett
>
>
> On Thu, May 29, 2014 at 6:41 AM, Andrea Aime <andrea.a...@geo-solutions.it
> > wrote:
>
>> On Wed, May 28, 2014 at 10:57 AM, Roger Bedell <sylvanasc...@gmail.com>wrote:
>>
>>> Looking for suggestions. I'd like to multiply the output of one of the
>>> properties of a WFS request, similar to what I'm doing in an SLD to convert
>>> meters to feet for my "value" property.
>>>
>>> Does this make any sense? It doesn't appear to work, and reading the WFS
>>> spec is not helping.
>>>
>>
>> You cannot do any kind of calculation with WFS. Look at WPS instead, it's
>> the OGC protocol
>> meant to do any kind of calculation.
>>
>> Unfortunately there is no out of the box process doing exactly what you
>> want, but with some java programming
>> the TransformProcess defined in GeoTools could be made usable in
>> GeoServer WPS.
>>
>> Cheers
>> Andrea
>>
>> --
>> ==
>> Meet us at GEO Business 2014! in London! Visit http://goo.gl/fES3aK
>> 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
>>
>> -------------------------------------------------------
>>
>>
>> ------------------------------------------------------------------------------
>> Time is money. Stop wasting it! Get your web API in 5 minutes.
>> www.restlet.com/download
>> http://p.sf.net/sfu/restlet
>> _______________________________________________
>> Geoserver-users mailing list
>> Geoserver-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>>
>>
>
------------------------------------------------------------------------------
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to