Ok. I did resolve it:
from geoserver.wps import process
#from geoscript.geom import Geometry
from StringIO import StringIO
@process(
title='Sample',
description='Sample',
inputs={'arg1': (int, 'first argument'),
'arg2': (int, 'second argument')},
outputs={'result': (str, 'The buffered geometry')}
)
def run(arg1, arg2):
#return "hello world";
return str(arg1+arg2);
I'll continue working on it. Thanks for the help.
2016-06-29 8:06 GMT-03:00 Jorge Infante <[email protected]>:
> Ok, Justin.
> I'm trying to use wps to implement my service.
> I did try a basic "hello world" sample. My sample try to return a string
> with "hello world":
>
> #more scripts/wps/sample.py
> from geoserver.wps import process
> from StringIO import StringIO
>
> @process(
> title='Sample',
> description='Sample',
> inputs={},
> outputs={'result': (StringIO, 'The constant hello world')}
> )
> def run():
> buff = StringIO("hello world")
> return buff;
>
> When I try to execute the process with:
> wget "
> http://localhost:8080/geoserver/wps?service=WPS&version=1.0.0&request=Execute&identifier=py:sample"
> -O -
>
> I don't have errors, but, I can't to see the "hello world" text.
> I'm thinking the problem is the output definition. What is the list of
> datatypes on this?
>
>
> 2016-06-02 10:33 GMT-03:00 Justin Deoliveira <[email protected]>:
>
>> Hi Jorge,
>>
>> The docs you are looking at are for the old “python” extension that
>> pre-dates the “script” extension. You should follow the documentation
>> located here:
>>
>> http://docs.geoserver.org/stable/en/user/community/scripting/index.html
>>
>> In particular if you are looking to hook into wps you can find some
>> details and samples here:
>>
>>
>> http://docs.geoserver.org/stable/en/user/community/scripting/hooks.html#web-processing-service
>>
>> Hope that helps.
>>
>> -Justin
>>
>> On Thu, Jun 2, 2016 at 5:36 AM Jorge Infante <[email protected]>
>> wrote:
>>
>>> Hi.
>>> I'm using geoserver 2.8.1, builded from sources, and on runtime format.
>>>
>>> I'm trying to run python code to do customs, in geoserver.
>>>
>>> I did install the wps extension, create the data_dir/scripts/wps
>>> directory, and put my sample.py on it.
>>> I'm not getting type py:sample on the demo/wps request builder.
>>> I did detect (in the builded from sources version), a message "2016-06-01
>>> 18:14:22,784 DEBUG [script.wps] - Skipping sample.py, no hook found"
>>>
>>> I did try, too, to install the python extension (documented on
>>> http://docs.geoserver.org/2.6.x/en/user/community/python/installation.html
>>> ).
>>> This method is no longer available in versions 2.8.x or higher? It was
>>> replaced by something else?
>>>
>>> Surely I'm wrong in the process. someone can give me a hint?
>>>
>>> TIA
>>>
>>> jorge infante
>>> rosario - santa fe - argentina
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> What NetFlow Analyzer can do for you? Monitors network bandwidth and
>>> traffic
>>> patterns at an interface-level. Reveals which users, apps, and protocols
>>> are
>>> consuming the most bandwidth. Provides multi-vendor support for NetFlow,
>>> J-Flow, sFlow and other flows. Make informed decisions using capacity
>>> planning reports.
>>> https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
>>> _______________________________________________
>>> Geoserver-devel mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/geoserver-devel
>>>
>>
>
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel