i created a new WPS process. I have a class with method and class with implementation into GeoServer.

@DescribeProcess(title="overlayWPS", description="Creates buffer around point and overlays it with polygon layer. Returns areas of overlay.")
public class OverlayPolygons implements GeoServerProcess {

    @DescribeResult(name="result", description="output result")
    public String execute() throws IOException{
        Process p = new Process();
        return p.overlayPolygons();

i would like to put input shapefiles as parameter which can user change in wps requiest builder, now i have static URL to specific shp

String overlayPolygons() throws IOException {

        String areas = "Object : Area of overlay";

        ShapefileDataStore sfds;
        sfds = new ShapefileDataStore(new URL("file:///F:\\GeoServer285\\data_dir\\data\\test_data\\lesy_cr.shp"));

        SimpleFeatureSource fs;
        fs = sfds.getFeatureSource("lesy_cr");

        ShapefileDataStore sfds2;
        sfds2 = new ShapefileDataStore(new URL("file:///F:\\GeoServer285\\data_dir\\data\\test_data\\chranene_uzemi_cr.shp"));

        SimpleFeatureSource fs2;
        fs2 = sfds2.getFeatureSource("chranene_uzemi_cr");

I found out there must be some @DescribeParameter annotation, but i cant figure out how to use it at all.


The best example of WPS processes is the GeoTools' tutorial. Input parameters are declared as parameters to the (static) process method and need to be annotated with @DescribeParameter that allows you to specify a name, type and optionally minimum and maximum number of occurrences etc.

Rather than specifying a Shapefile explicitly, you probably want to use a SimpleFeatureCollection which would allow you to set the process up with any GeoServer vector data source.

Here is an example:

@DescribeProcess(title = "Table Join", description = "Join two FeatureCollections based on a Join (including optional alias)")
  @DescribeResult(description = "the two collections joined together.")

  static public SimpleFeatureCollection joinTables(
      @DescribeParameter(name = "target", description = "the collection to be joined to", min = 1) SimpleFeatureCollection target,
      @DescribeParameter(name = "source", description = "the collection to be joined", min = 1, meta = {
          "mimeTypes=text/csv" }) SimpleFeatureCollection joinSource,
      @DescribeParameter(name = "join", description = "the Join element that describes the relationship between the collections", min = 1, meta = {
          "mimeTypes=text/xml" }) String joinXML) {
    Join join = null;
    join = parseJoinXML(joinXML);

    if (target == null) {
      throw new IllegalArgumentException("target can not be null");
    if (joinSource == null) {
      throw new IllegalArgumentException("source can not be null");
    if (join == null || join.getFilter() == null) {
      throw new IllegalArgumentException("join can not be null");

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.