[Geoserver-users] Creating a programmatically dynamically generated WMS layer

I want to create a WMS layer which does not (directly) come from any canned shapefile or other service. I need to get at the parameters of the GetMap query, use them to query some geospatial data, and generate my own image which is based on that data. So I'm thinking I need a way to create some sort of plugin. E.g. I could create the raw image data, say as a Java BufferedImage object, and then pass that off to some other part of the system to convert to a data stream in some image file format, which is sent back to the client.

Reference docs on the website (http://geoserver.org/display/GEOSDOC/0+Extension+Points) list two extension points; neither quite matches what I need. I don't need new image formats or WMS operations. (Also, that web page prominently says it's no longer relevant... not sure what to make of that. Is the concept of extension points irrelevant, or are those particular extension points no longer relevant, or are they still there but the extension mechanism is implemented differently...?)

I am a newbie to GeoServer and to WMS's. Apologies if I am on the wrong list. In my mind, plugins sit somewhere in between development of geoserver itself (the dev list) and use and configuration of the webapp (the user list). Is GeoServer designed to be extended in the way I have described? How hard would it be to do this? I'm not even wedded to GeoServer, if anyone has a suggestion for another tool (preferably Java) which would be more suitable.

Thanks
Andy

Hi Michael,

Check out http://geoserver.org/display/GEOSDOC/3+A+Simple+PlugIn.

It is a simple example of writing a new service. You could write your own custom wms service. To save you some work you could use the existing WMS "request" objects. Check out the doc and let me know if it makes sense.

Also if you want to log into the geoserver irc channel freenode#geoserver I would be happy to discuss further.

-Justin

Michael Chisholm wrote:

I want to create a WMS layer which does not (directly) come from any canned shapefile or other service. I need to get at the parameters of the GetMap query, use them to query some geospatial data, and generate my own image which is based on that data. So I'm thinking I need a way to create some sort of plugin. E.g. I could create the raw image data, say as a Java BufferedImage object, and then pass that off to some other part of the system to convert to a data stream in some image file format, which is sent back to the client.

Reference docs on the website (http://geoserver.org/display/GEOSDOC/0+Extension+Points) list two extension points; neither quite matches what I need. I don't need new image formats or WMS operations. (Also, that web page prominently says it's no longer relevant... not sure what to make of that. Is the concept of extension points irrelevant, or are those particular extension points no longer relevant, or are they still there but the extension mechanism is implemented differently...?)

I am a newbie to GeoServer and to WMS's. Apologies if I am on the wrong list. In my mind, plugins sit somewhere in between development of geoserver itself (the dev list) and use and configuration of the webapp (the user list). Is GeoServer designed to be extended in the way I have described? How hard would it be to do this? I'm not even wedded to GeoServer, if anyone has a suggestion for another tool (preferably Java) which would be more suitable.

Thanks
Andy

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

Thanks, that example shows how to create a very basic service. It pretty much just seems like an arbitrary Java servlet embedded in GeoServer. I was hoping to leverage a lot more of the GeoServer functionality. E.g.

- Can I implement this as a true WMS layer, so that rather than creating a new operation, I can use GetMap?
- Can I somehow make GeoServer aware of my new layer, so that GetCapabilities responses will include the layer?
- Can I get GeoServer to parse the request parameters into a GetMapRequest object (if that's the right class) so I don't have to deal with the HttpServletRequest parameters directly?
- Can I get GeoServer to convert image data to the proper image file format automatically, according to the WMS config and the GetMap request parameters?

Andy

Justin Deoliveira wrote:

Hi Michael,

Check out http://geoserver.org/display/GEOSDOC/3+A+Simple+PlugIn.

It is a simple example of writing a new service. You could write your own custom wms service. To save you some work you could use the existing WMS "request" objects. Check out the doc and let me know if it makes sense.

Also if you want to log into the geoserver irc channel freenode#geoserver I would be happy to discuss further.

-Justin

Michael Chisholm wrote:
  

I want to create a WMS layer which does not (directly) come from any canned shapefile or other service. I need to get at the parameters of the GetMap query, use them to query some geospatial data, and generate my own image which is based on that data. So I'm thinking I need a way to create some sort of plugin. E.g. I could create the raw image data, say as a Java BufferedImage object, and then pass that off to some other part of the system to convert to a data stream in some image file format, which is sent back to the client.

Reference docs on the website (http://geoserver.org/display/GEOSDOC/0+Extension+Points) list two extension points; neither quite matches what I need. I don't need new image formats or WMS operations. (Also, that web page prominently says it's no longer relevant... not sure what to make of that. Is the concept of extension points irrelevant, or are those particular extension points no longer relevant, or are they still there but the extension mechanism is implemented differently...?)

I am a newbie to GeoServer and to WMS's. Apologies if I am on the wrong list. In my mind, plugins sit somewhere in between development of geoserver itself (the dev list) and use and configuration of the webapp (the user list). Is GeoServer designed to be extended in the way I have described? How hard would it be to do this? I'm not even wedded to GeoServer, if anyone has a suggestion for another tool (preferably Java) which would be more suitable.

Thanks
Andy

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users
    

Hi Michael,

Yeah, so what I was thinking was this. You create a new custom WMS class, lets call it "WebMapServiceX". It would look like this:

class WebMapServiceX {

   getMap( GetMapRequest request ){

   }

}

GeoServer will automatically do the request parsing like a regular getmap request b/c your method declares a parameter of type GetMapRequest.

Now... as for producing the image... i think there are a few options here.

1) the service architecture allows you declare a parameter which is the HttpServiceResponse directly in the service method. So it would look like:

getMap( GetMapRequest request, HttpServletResponse response ) {

}

Then your method can simply produce the image, and write it directly to the output stream. This might be simplest approach.

2) use the GetMapResponse mechanism. The regular Getmap Request returns a GetMapResponse which basically loads data from an underlying DataStore(vector) or CoverageStore(raster), and writes it out. Since your data is custom to fit into that framework you would have to write an implementation of geotools CoverageStore or DataStore... which is not trivial. You said in your initial mail that you have to load data from some geospatial datastore and generate an image for it. If you tell us more about the data we can describe more how this approach might work.

Now getting the capabilities to pick up your special layer. It should be doable by adding another method called GetCapabilities which returns a subclass of WmsCapsTransformer... and you would have to override some methods there, notably handleLayers() to add your "special layer". So it would look like:

WmsCapabilitiesTransformer getCapabilities() {
    return new SubclassOfWmsCapabilitiesTransformer() {

      //override
      void handleLayers() {

      }
    };
}

As for converting a BufferedImage to particular image format takea look at subclasses of DefaultRasterMapProducer. There will be some examples of the classes to use to accomplish this.

Hope that helps. Feel free to keep on asking questions, or if you want clarification on anything.

-Justin
Michael Chisholm wrote:

Thanks, that example shows how to create a very basic service. It pretty much just seems like an arbitrary Java servlet embedded in GeoServer. I was hoping to leverage a lot more of the GeoServer functionality. E.g.

- Can I implement this as a true WMS layer, so that rather than creating a new operation, I can use GetMap?
- Can I somehow make GeoServer aware of my new layer, so that GetCapabilities responses will include the layer?
- Can I get GeoServer to parse the request parameters into a GetMapRequest object (if that's the right class) so I don't have to deal with the HttpServletRequest parameters directly?
- Can I get GeoServer to convert image data to the proper image file format automatically, according to the WMS config and the GetMap request parameters?

Andy

Justin Deoliveira wrote:

Hi Michael,

Check out http://geoserver.org/display/GEOSDOC/3+A+Simple+PlugIn.

It is a simple example of writing a new service. You could write your own custom wms service. To save you some work you could use the existing WMS "request" objects. Check out the doc and let me know if it makes sense.

Also if you want to log into the geoserver irc channel freenode#geoserver I would be happy to discuss further.

-Justin

Michael Chisholm wrote:
  

I want to create a WMS layer which does not (directly) come from any canned shapefile or other service. I need to get at the parameters of the GetMap query, use them to query some geospatial data, and generate my own image which is based on that data. So I'm thinking I need a way to create some sort of plugin. E.g. I could create the raw image data, say as a Java BufferedImage object, and then pass that off to some other part of the system to convert to a data stream in some image file format, which is sent back to the client.

Reference docs on the website (http://geoserver.org/display/GEOSDOC/0+Extension+Points) list two extension points; neither quite matches what I need. I don't need new image formats or WMS operations. (Also, that web page prominently says it's no longer relevant... not sure what to make of that. Is the concept of extension points irrelevant, or are those particular extension points no longer relevant, or are they still there but the extension mechanism is implemented differently...?)

I am a newbie to GeoServer and to WMS's. Apologies if I am on the wrong list. In my mind, plugins sit somewhere in between development of geoserver itself (the dev list) and use and configuration of the webapp (the user list). Is GeoServer designed to be extended in the way I have described? How hard would it be to do this? I'm not even wedded to GeoServer, if anyone has a suggestion for another tool (preferably Java) which would be more suitable.

Thanks
Andy

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users
    
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

Does the 'dwithin' query actually work in GeoServer 1.7.x? I'm sending
in a req with an otherwise happy OpenLayers client:

//snip

        buffer=new OpenLayers.Filter.Spatial(
          {

type:OpenLayers.Filter.Spatial.DWITHIN,
            value:new
OpenLayers.Bounds(-9564110.76175746,3998030.99014938,-9549653.2791347,40
09571.98657578),
            distanceUnits:"m",
            distance:500
            
          }
        );

Which, serverside, yields this:
-----------------------------------
12 Jan 14:11:59 INFO [geoserver.wfs] -
Request: getFeature
        handle = null
        service = WFS
        version = 1.0.0
        baseUrl = http://br5756dev:8080/geoserver/
        providedVersion = 1.0.0
        query = [net.opengis.wfs.impl.QueryTypeImpl@anonymised.com (group: null,
propert
yName: null, function: null, filter: [[ the_geom dwithin POLYGON
((-9564110.7617
5746 3998030.99014938, -9549653.2791347 3998030.99014938,
-9549653.2791347 40095
71.98657578, -9564110.76175746 4009571.98657578, -9564110.76175746
3998030.99014
938)), distance: 500.0 ]], sortBy: null, featureVersion: null, handle:
null, srs
Name: EPSG:900913, typeName: [{http://www.openplans.org/topp\}zone])]
        maxFeatures = null
        outputFormat = GML2
        resultType = results
        traverseXlinkDepth = null
        traverseXlinkExpiry = null
        formatOptions = {}
-----------------------------------
Which, returns nothing...

Is this related to http://jira.codehaus.org/browse/GEOS-937

This is looking better! I am looking at the javadocs for GeoServer 1.7.1, and GeoTools 2.6 (http://javadoc.geotools.fr/snapshot/index.html). Some details don't match up with your description. I found DataStore as part of the GeoTools API, but there wasn't a CoverageStore in either GeoServer or GeoTools. Closest I found was interface CoverageStoreInfo in GeoServer. Also, GeoServer's WMSCapsTransformer class doesn't have a handleLayers() method.

I emphasized what I thought I needed from GeoServer, and de-emphasized what I considered implementation details. But if it would help, the data store is a PostGIS database with point data. So I guess I would be reading from a DataStore. I do see a PostgisDataStore subclass, so hopefully I won't need any custom implementation for this part.

It looks like I would have to inspect the requested format, compare against the formats listed in the capabilities, and if there isn't a match, cause a service exception (throw WmsException?). Otherwise, use the appropriate map producer to produce the image. This seemed like something that needs to be done for every GetMap request, and so would be implemented somewhere I could reuse it, but should be easy enough to do myself.

So I guess the remaining questions are how to get GeoServer to pick up my new layer, and to fill in the blanks about using GetMapResponse (in case I choose to go that route). I didn't see any method of GetMapRequest which returned a GetMapResponse, though I may have overlooked it, or misunderstood.

Andy

Justin Deoliveira wrote:

Hi Michael,

Yeah, so what I was thinking was this. You create a new custom WMS class, lets call it "WebMapServiceX". It would look like this:

class WebMapServiceX {

   getMap( GetMapRequest request ){

   }

}

GeoServer will automatically do the request parsing like a regular getmap request b/c your method declares a parameter of type GetMapRequest.

Now... as for producing the image... i think there are a few options here.

1) the service architecture allows you declare a parameter which is the HttpServiceResponse directly in the service method. So it would look like:

getMap( GetMapRequest request, HttpServletResponse response ) {

}

Then your method can simply produce the image, and write it directly to the output stream. This might be simplest approach.

2) use the GetMapResponse mechanism. The regular Getmap Request returns a GetMapResponse which basically loads data from an underlying DataStore(vector) or CoverageStore(raster), and writes it out. Since your data is custom to fit into that framework you would have to write an implementation of geotools CoverageStore or DataStore... which is not trivial. You said in your initial mail that you have to load data from some geospatial datastore and generate an image for it. If you tell us more about the data we can describe more how this approach might work.

Now getting the capabilities to pick up your special layer. It should be doable by adding another method called GetCapabilities which returns a subclass of WmsCapsTransformer... and you would have to override some methods there, notably handleLayers() to add your "special layer". So it would look like:

WmsCapabilitiesTransformer getCapabilities() {
    return new SubclassOfWmsCapabilitiesTransformer() {

      //override
      void handleLayers() {

      }
    };
}

As for converting a BufferedImage to particular image format takea look at subclasses of DefaultRasterMapProducer. There will be some examples of the classes to use to accomplish this.

Hope that helps. Feel free to keep on asking questions, or if you want clarification on anything.

-Justin
Michael Chisholm wrote:
  

Thanks, that example shows how to create a very basic service. It pretty much just seems like an arbitrary Java servlet embedded in GeoServer. I was hoping to leverage a lot more of the GeoServer functionality. E.g.

- Can I implement this as a true WMS layer, so that rather than creating a new operation, I can use GetMap?
- Can I somehow make GeoServer aware of my new layer, so that GetCapabilities responses will include the layer?
- Can I get GeoServer to parse the request parameters into a GetMapRequest object (if that's the right class) so I don't have to deal with the HttpServletRequest parameters directly?
- Can I get GeoServer to convert image data to the proper image file format automatically, according to the WMS config and the GetMap request parameters?

Andy

Justin Deoliveira wrote:
    

Hi Michael,

Check out http://geoserver.org/display/GEOSDOC/3+A+Simple+PlugIn.

It is a simple example of writing a new service. You could write your own custom wms service. To save you some work you could use the existing WMS "request" objects. Check out the doc and let me know if it makes sense.

Also if you want to log into the geoserver irc channel freenode#geoserver I would be happy to discuss further.

-Justin

Michael Chisholm wrote:
  

I want to create a WMS layer which does not (directly) come from any canned shapefile or other service. I need to get at the parameters of the GetMap query, use them to query some geospatial data, and generate my own image which is based on that data. So I'm thinking I need a way to create some sort of plugin. E.g. I could create the raw image data, say as a Java BufferedImage object, and then pass that off to some other part of the system to convert to a data stream in some image file format, which is sent back to the client.

Reference docs on the website (http://geoserver.org/display/GEOSDOC/0+Extension+Points) list two extension points; neither quite matches what I need. I don't need new image formats or WMS operations. (Also, that web page prominently says it's no longer relevant... not sure what to make of that. Is the concept of extension points irrelevant, or are those particular extension points no longer relevant, or are they still there but the extension mechanism is implemented differently...?)

I am a newbie to GeoServer and to WMS's. Apologies if I am on the wrong list. In my mind, plugins sit somewhere in between development of geoserver itself (the dev list) and use and configuration of the webapp (the user list). Is GeoServer designed to be extended in the way I have described? How hard would it be to do this? I'm not even wedded to GeoServer, if anyone has a suggestion for another tool (preferably Java) which would be more suitable.

Thanks
Andy

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users
    
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users
    

I think you could use the "new image format" hook. Your layer, of
course, is not based on a data file but is generated totally another way
- but it still does the job of saying to the rest of the geoserver
"based on some data that I have (even though it's not from a file), here
are some shapes".

If the geoserver insists that you do use a file, then you could always
stick the connection configuration in it, and that becomes your "image
data" that your plugin knows how to parse.

Alternatively, the geoserver can link to services that provide shapes.
You could write a service that implements that protocol directly, and
point the geoserver at it.

-----Original Message-----
From: Michael Chisholm [mailto:chisholm@anonymised.com]
Sent: Tuesday, 13 January 2009 6:20 AM
To: geoserver-users@lists.sourceforge.net
Subject: [Geoserver-users] Creating a programmatically dynamically
generatedWMS layer

I want to create a WMS layer which does not (directly) come from any
canned shapefile or other service. I need to get at the parameters of
the GetMap query, use them to query some geospatial data, and generate
my own image which is based on that data. So I'm thinking I need a way
to create some sort of plugin. E.g. I could create the raw image data,
say as a Java BufferedImage object, and then pass that off to some other
part of the system to convert to a data stream in some image file
format, which is sent back to the client.

Reference docs on the website
(http://geoserver.org/display/GEOSDOC/0+Extension+Points) list two
extension points; neither quite matches what I need. I don't need new
image formats or WMS operations. (Also, that web page prominently says
it's no longer relevant... not sure what to make of that. Is the
concept of extension points irrelevant, or are those particular
extension points no longer relevant, or are they still there but the
extension mechanism is implemented differently...?)

I am a newbie to GeoServer and to WMS's. Apologies if I am on the wrong
list. In my mind, plugins sit somewhere in between development of
geoserver itself (the dev list) and use and configuration of the webapp
(the user list). Is GeoServer designed to be extended in the way I have
described? How hard would it be to do this? I'm not even wedded to
GeoServer, if anyone has a suggestion for another tool (preferably Java)
which would be more suitable.

Thanks
Andy

------------------------------------------------------------------------
------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

------
If you have received this transmission in error please notify us immediately by return e-mail and delete all copies. If this e-mail or any attachments have been sent to you in error, that error does not constitute waiver of any confidentiality, privilege or copyright in respect of information in the e-mail or attachments.

Please consider the environment before printing this email.

------

Apologies, let me clarify a bit.

AbstractGridFormat and GridCoverageReader are the classes / interfaces in GeoTools you would have to implement to plug in at the GeoTools level.

The handlerLayers() methods is actually defined in a inner class of WmsCapsTransformer: CapabilitiesTranslator.

So, knowing that you are dealing with point data in a postgis database i am a little uncertain why you need a custom plugin?

-Justin

Michael Chisholm wrote:

This is looking better! I am looking at the javadocs for GeoServer 1.7.1, and GeoTools 2.6 (http://javadoc.geotools.fr/snapshot/index.html). Some details don't match up with your description. I found DataStore as part of the GeoTools API, but there wasn't a CoverageStore in either GeoServer or GeoTools. Closest I found was interface CoverageStoreInfo in GeoServer. Also, GeoServer's WMSCapsTransformer class doesn't have a handleLayers() method.

I emphasized what I thought I needed from GeoServer, and de-emphasized what I considered implementation details. But if it would help, the data store is a PostGIS database with point data. So I guess I would be reading from a DataStore. I do see a PostgisDataStore subclass, so hopefully I won't need any custom implementation for this part.

It looks like I would have to inspect the requested format, compare against the formats listed in the capabilities, and if there isn't a match, cause a service exception (throw WmsException?). Otherwise, use the appropriate map producer to produce the image. This seemed like something that needs to be done for every GetMap request, and so would be implemented somewhere I could reuse it, but should be easy enough to do myself.

So I guess the remaining questions are how to get GeoServer to pick up my new layer, and to fill in the blanks about using GetMapResponse (in case I choose to go that route). I didn't see any method of GetMapRequest which returned a GetMapResponse, though I may have overlooked it, or misunderstood.

Andy

Justin Deoliveira wrote:

Hi Michael,

Yeah, so what I was thinking was this. You create a new custom WMS class, lets call it "WebMapServiceX". It would look like this:

class WebMapServiceX {

   getMap( GetMapRequest request ){

   }

}

GeoServer will automatically do the request parsing like a regular getmap request b/c your method declares a parameter of type GetMapRequest.

Now... as for producing the image... i think there are a few options here.

1) the service architecture allows you declare a parameter which is the HttpServiceResponse directly in the service method. So it would look like:

getMap( GetMapRequest request, HttpServletResponse response ) {

}

Then your method can simply produce the image, and write it directly to the output stream. This might be simplest approach.

2) use the GetMapResponse mechanism. The regular Getmap Request returns a GetMapResponse which basically loads data from an underlying DataStore(vector) or CoverageStore(raster), and writes it out. Since your data is custom to fit into that framework you would have to write an implementation of geotools CoverageStore or DataStore... which is not trivial. You said in your initial mail that you have to load data from some geospatial datastore and generate an image for it. If you tell us more about the data we can describe more how this approach might work.

Now getting the capabilities to pick up your special layer. It should be doable by adding another method called GetCapabilities which returns a subclass of WmsCapsTransformer... and you would have to override some methods there, notably handleLayers() to add your "special layer". So it would look like:

WmsCapabilitiesTransformer getCapabilities() {
    return new SubclassOfWmsCapabilitiesTransformer() {

      //override
      void handleLayers() {

      }
    };
}

As for converting a BufferedImage to particular image format takea look at subclasses of DefaultRasterMapProducer. There will be some examples of the classes to use to accomplish this.

Hope that helps. Feel free to keep on asking questions, or if you want clarification on anything.

-Justin
Michael Chisholm wrote:
  

Thanks, that example shows how to create a very basic service. It pretty much just seems like an arbitrary Java servlet embedded in GeoServer. I was hoping to leverage a lot more of the GeoServer functionality. E.g.

- Can I implement this as a true WMS layer, so that rather than creating a new operation, I can use GetMap?
- Can I somehow make GeoServer aware of my new layer, so that GetCapabilities responses will include the layer?
- Can I get GeoServer to parse the request parameters into a GetMapRequest object (if that's the right class) so I don't have to deal with the HttpServletRequest parameters directly?
- Can I get GeoServer to convert image data to the proper image file format automatically, according to the WMS config and the GetMap request parameters?

Andy

Justin Deoliveira wrote:
    

Hi Michael,

Check out http://geoserver.org/display/GEOSDOC/3+A+Simple+PlugIn.

It is a simple example of writing a new service. You could write your own custom wms service. To save you some work you could use the existing WMS "request" objects. Check out the doc and let me know if it makes sense.

Also if you want to log into the geoserver irc channel freenode#geoserver I would be happy to discuss further.

-Justin

Michael Chisholm wrote:
  

I want to create a WMS layer which does not (directly) come from any canned shapefile or other service. I need to get at the parameters of the GetMap query, use them to query some geospatial data, and generate my own image which is based on that data. So I'm thinking I need a way to create some sort of plugin. E.g. I could create the raw image data, say as a Java BufferedImage object, and then pass that off to some other part of the system to convert to a data stream in some image file format, which is sent back to the client.

Reference docs on the website (http://geoserver.org/display/GEOSDOC/0+Extension+Points) list two extension points; neither quite matches what I need. I don't need new image formats or WMS operations. (Also, that web page prominently says it's no longer relevant... not sure what to make of that. Is the concept of extension points irrelevant, or are those particular extension points no longer relevant, or are they still there but the extension mechanism is implemented differently...?)

I am a newbie to GeoServer and to WMS's. Apologies if I am on the wrong list. In my mind, plugins sit somewhere in between development of geoserver itself (the dev list) and use and configuration of the webapp (the user list). Is GeoServer designed to be extended in the way I have described? How hard would it be to do this? I'm not even wedded to GeoServer, if anyone has a suggestion for another tool (preferably Java) which would be more suitable.

Thanks
Andy

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users
    

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users
    
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

Diez, Matthew ha scritto:

Does the 'dwithin' query actually work in GeoServer 1.7.x? I'm sending
in a req with an otherwise happy OpenLayers client:

//snip

        buffer=new OpenLayers.Filter.Spatial(
          {

type:OpenLayers.Filter.Spatial.DWITHIN,
            value:new
OpenLayers.Bounds(-9564110.76175746,3998030.99014938,-9549653.2791347,40
09571.98657578),
            distanceUnits:"m",
            distance:500
            
          }
        );

So it's all in meters, the data source is projected, not lat/lon right?
In that case it should work?

The only issue I'm aware of is that dwithin is working in pure
cartesian mode, if your data is lon/lat there is no easy way
that I know of to make it work. If you have suggestions in that
respect, I'll all ears :slight_smile:

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Ah, and yes, my data source is in lon/lat, so, it -is- GEOS-937 that is
the reason.

Grazie,
Matthew D. Diez

-----Original Message-----
From: Andrea Aime [mailto:aaime@anonymised.com]
Sent: Tuesday, January 13, 2009 1:31 AM
To: Diez, Matthew
Cc: geoserver-users@lists.sourceforge.net
Subject: Re: [Geoserver-users] Dwithin/Spatial Query + OpenLayers
(GEOS-937)

Diez, Matthew ha scritto:

Does the 'dwithin' query actually work in GeoServer 1.7.x? I'm sending

in a req with an otherwise happy OpenLayers client:

//snip

        buffer=new OpenLayers.Filter.Spatial(
          {

type:OpenLayers.Filter.Spatial.DWITHIN,
            value:new
OpenLayers.Bounds(-9564110.76175746,3998030.99014938,-9549653.2791347,
40
09571.98657578),
            distanceUnits:"m",
            distance:500
            
          }
        );

So it's all in meters, the data source is projected, not lat/lon right?
In that case it should work?

The only issue I'm aware of is that dwithin is working in pure cartesian
mode, if your data is lon/lat there is no easy way that I know of to
make it work. If you have suggestions in that respect, I'll all ears :slight_smile:

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

I need the plugin because although the data is point data from a PostGIS database, I'm not just going to draw a map with a bunch of dots. That's where my customization comes in. I can take that data and draw anything I want. In my case, I want to draw a "heatmap", which is a blobby looking thing that is brighter where there are more dots and dimmer where there are fewer. Most of the functionality is there in GeoServer/GeoTools; I was just hoping to plugin my own drawing code so I can draw my own thing.

I think the API you are describing must not be public and not in the javadoc; I'll have to get the source code to see it.

Thanks
Andy

Justin Deoliveira wrote:

Apologies, let me clarify a bit.

AbstractGridFormat and GridCoverageReader are the classes / interfaces in GeoTools you would have to implement to plug in at the GeoTools level.

The handlerLayers() methods is actually defined in a inner class of WmsCapsTransformer: CapabilitiesTranslator.

So, knowing that you are dealing with point data in a postgis database i am a little uncertain why you need a custom plugin?

-Justin

Michael Chisholm wrote:
  

This is looking better! I am looking at the javadocs for GeoServer 1.7.1, and GeoTools 2.6 (http://javadoc.geotools.fr/snapshot/index.html). Some details don't match up with your description. I found DataStore as part of the GeoTools API, but there wasn't a CoverageStore in either GeoServer or GeoTools. Closest I found was interface CoverageStoreInfo in GeoServer. Also, GeoServer's WMSCapsTransformer class doesn't have a handleLayers() method.

I emphasized what I thought I needed from GeoServer, and de-emphasized what I considered implementation details. But if it would help, the data store is a PostGIS database with point data. So I guess I would be reading from a DataStore. I do see a PostgisDataStore subclass, so hopefully I won't need any custom implementation for this part.

It looks like I would have to inspect the requested format, compare against the formats listed in the capabilities, and if there isn't a match, cause a service exception (throw WmsException?). Otherwise, use the appropriate map producer to produce the image. This seemed like something that needs to be done for every GetMap request, and so would be implemented somewhere I could reuse it, but should be easy enough to do myself.

So I guess the remaining questions are how to get GeoServer to pick up my new layer, and to fill in the blanks about using GetMapResponse (in case I choose to go that route). I didn't see any method of GetMapRequest which returned a GetMapResponse, though I may have overlooked it, or misunderstood.

Andy

Justin Deoliveira wrote:
    

Hi Michael,

Yeah, so what I was thinking was this. You create a new custom WMS class, lets call it "WebMapServiceX". It would look like this:

class WebMapServiceX {

   getMap( GetMapRequest request ){

   }

}

GeoServer will automatically do the request parsing like a regular getmap request b/c your method declares a parameter of type GetMapRequest.

Now... as for producing the image... i think there are a few options here.

1) the service architecture allows you declare a parameter which is the HttpServiceResponse directly in the service method. So it would look like:

getMap( GetMapRequest request, HttpServletResponse response ) {

}

Then your method can simply produce the image, and write it directly to the output stream. This might be simplest approach.

2) use the GetMapResponse mechanism. The regular Getmap Request returns a GetMapResponse which basically loads data from an underlying DataStore(vector) or CoverageStore(raster), and writes it out. Since your data is custom to fit into that framework you would have to write an implementation of geotools CoverageStore or DataStore... which is not trivial. You said in your initial mail that you have to load data from some geospatial datastore and generate an image for it. If you tell us more about the data we can describe more how this approach might work.

Now getting the capabilities to pick up your special layer. It should be doable by adding another method called GetCapabilities which returns a subclass of WmsCapsTransformer... and you would have to override some methods there, notably handleLayers() to add your "special layer". So it would look like:

WmsCapabilitiesTransformer getCapabilities() {
    return new SubclassOfWmsCapabilitiesTransformer() {

      //override
      void handleLayers() {

      }
    };
}

As for converting a BufferedImage to particular image format takea look at subclasses of DefaultRasterMapProducer. There will be some examples of the classes to use to accomplish this.

Hope that helps. Feel free to keep on asking questions, or if you want clarification on anything.

-Justin
Michael Chisholm wrote:
  

Thanks, that example shows how to create a very basic service. It pretty much just seems like an arbitrary Java servlet embedded in GeoServer. I was hoping to leverage a lot more of the GeoServer functionality. E.g.

- Can I implement this as a true WMS layer, so that rather than creating a new operation, I can use GetMap?
- Can I somehow make GeoServer aware of my new layer, so that GetCapabilities responses will include the layer?
- Can I get GeoServer to parse the request parameters into a GetMapRequest object (if that's the right class) so I don't have to deal with the HttpServletRequest parameters directly?
- Can I get GeoServer to convert image data to the proper image file format automatically, according to the WMS config and the GetMap request parameters?

Andy

Justin Deoliveira wrote:
    

Hi Michael,

Check out http://geoserver.org/display/GEOSDOC/3+A+Simple+PlugIn.

It is a simple example of writing a new service. You could write your own custom wms service. To save you some work you could use the existing WMS "request" objects. Check out the doc and let me know if it makes sense.

Also if you want to log into the geoserver irc channel freenode#geoserver I would be happy to discuss further.

-Justin

Michael Chisholm wrote:
  

I want to create a WMS layer which does not (directly) come from any canned shapefile or other service. I need to get at the parameters of the GetMap query, use them to query some geospatial data, and generate my own image which is based on that data. So I'm thinking I need a way to create some sort of plugin. E.g. I could create the raw image data, say as a Java BufferedImage object, and then pass that off to some other part of the system to convert to a data stream in some image file format, which is sent back to the client.

Reference docs on the website (http://geoserver.org/display/GEOSDOC/0+Extension+Points) list two extension points; neither quite matches what I need. I don't need new image formats or WMS operations. (Also, that web page prominently says it's no longer relevant... not sure what to make of that. Is the concept of extension points irrelevant, or are those particular extension points no longer relevant, or are they still there but the extension mechanism is implemented differently...?)

I am a newbie to GeoServer and to WMS's. Apologies if I am on the wrong list. In my mind, plugins sit somewhere in between development of geoserver itself (the dev list) and use and configuration of the webapp (the user list). Is GeoServer designed to be extended in the way I have described? How hard would it be to do this? I'm not even wedded to GeoServer, if anyone has a suggestion for another tool (preferably Java) which would be more suitable.

Thanks
Andy

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users
    

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users
    
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users
    

Michael Chisholm ha scritto:

I need the plugin because although the data is point data from a PostGIS database, I'm not just going to draw a map with a bunch of dots. That's where my customization comes in. I can take that data and draw anything I want. In my case, I want to draw a "heatmap", which is a blobby looking thing that is brighter where there are more dots and dimmer where there are fewer. Most of the functionality is there in GeoServer/GeoTools; I was just hoping to plugin my own drawing code so I can draw my own thing.

This could be done if we had a pluggable, per layer renderer, but that's
not one of the extensions points we have at the moment. The renderer
now is a given, it's not customisable.

Having a pluggable renderer has been a desire of mine for quite some
time but that may some major changes in GeoTools, so never actually
found the time to work on it.

Please open a "new feature" request, if many people vote on it we
can look into it, or try to look for funding to setup the proper
architecture and so on

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Andrea Aime wrote:

Michael Chisholm ha scritto:
  

I need the plugin because although the data is point data from a PostGIS database, I'm not just going to draw a map with a bunch of dots. That's where my customization comes in. I can take that data and draw anything I want. In my case, I want to draw a "heatmap", which is a blobby looking thing that is brighter where there are more dots and dimmer where there are fewer. Most of the functionality is there in GeoServer/GeoTools; I was just hoping to plugin my own drawing code so I can draw my own thing.
    
This could be done if we had a pluggable, per layer renderer, but that's
not one of the extensions points we have at the moment. The renderer
now is a given, it's not customisable.

Having a pluggable renderer has been a desire of mine for quite some
time but that may some major changes in GeoTools, so never actually
found the time to work on it.

Please open a "new feature" request, if many people vote on it we
can look into it, or try to look for funding to setup the proper
architecture and so on

Cheers
Andrea
  

Ok, I added the feature request: http://jira.codehaus.org/browse/GEOS-2565

Modify it as you see fit :slight_smile:

Thanks,
Andy

In light of what Andrea has said regarding lack of an extension point for plugging in custom renderers, perhaps pursuing this is futile. I'm not sure if you are describing the dirty hackish way, whereas Andrea is describing the ideal way, or if you misunderstood what I wanted, and now agree it's not realistically possible. But I thought I'd at least try to get the basic plugin working from the tutorial you pointed me to.

It isn't working for me. First, one comment: the example code uses the Java servlet API, which is not an inherited dependency from the org.geoserver.community pom, so the plugin pom as given in the tutorial doesn't quite work. I had to add another dependency (see the attached pom file).

The jar file is in my WEB-INF\lib directory:

[c:\programming\java\geoserver-1.7.1]dir webapps\geoserver\WEB-INF\lib\hello*

Volume in drive C is C-DISK Serial number is 24A2:50A4
Directory of C:\Programming\Java\geoserver-1.7.1\webapps\geoserver\WEB-INF\lib\hello*

1/13/2009 16:14 3,222 hello-0.0.1-SNAPSHOT.jar
          3,222 bytes in 1 file and 0 dirs 4,096 bytes allocated
21,512,957,952 bytes free

I access the URL: http://localhost:8080/geoserver/ows?request=sayHello&service=hello&version=1.0.0

The exception is: org.geoserver.platform.ServiceException: No service: ( hello )

(You can see the complete Jetty log output in another attached file.)

The jar file contents:

[c:\programming\java\geoserver-1.7.1]jar tf webapps\geoserver\WEB-INF\lib\hello-0.0.1-SNAPSHOT.jar
META-INF/
META-INF/MANIFEST.MF
org/
org/mitre/
org/mitre/geoserver/
org/mitre/geoserver/test/
org/mitre/geoserver/test/applicationContext.xml
org/mitre/geoserver/test/HelloWorld.class
META-INF/maven/
META-INF/maven/org.geoserver/
META-INF/maven/org.geoserver/hello/
META-INF/maven/org.geoserver/hello/pom.xml
META-INF/maven/org.geoserver/hello/pom.properties

Any idea what I'm doing wrong?

Andy

Justin Deoliveira wrote:

Hi Michael,

Check out http://geoserver.org/display/GEOSDOC/3+A+Simple+PlugIn.

It is a simple example of writing a new service. You could write your own custom wms service. To save you some work you could use the existing WMS "request" objects. Check out the doc and let me know if it makes sense.

Also if you want to log into the geoserver irc channel freenode#geoserver I would be happy to discuss further.

-Justin

Michael Chisholm wrote:
  

I want to create a WMS layer which does not (directly) come from any canned shapefile or other service. I need to get at the parameters of the GetMap query, use them to query some geospatial data, and generate my own image which is based on that data. So I'm thinking I need a way to create some sort of plugin. E.g. I could create the raw image data, say as a Java BufferedImage object, and then pass that off to some other part of the system to convert to a data stream in some image file format, which is sent back to the client.

Reference docs on the website (http://geoserver.org/display/GEOSDOC/0+Extension+Points) list two extension points; neither quite matches what I need. I don't need new image formats or WMS operations. (Also, that web page prominently says it's no longer relevant... not sure what to make of that. Is the concept of extension points irrelevant, or are those particular extension points no longer relevant, or are they still there but the extension mechanism is implemented differently...?)

I am a newbie to GeoServer and to WMS's. Apologies if I am on the wrong list. In my mind, plugins sit somewhere in between development of geoserver itself (the dev list) and use and configuration of the webapp (the user list). Is GeoServer designed to be extended in the way I have described? How hard would it be to do this? I'm not even wedded to GeoServer, if anyone has a suggestion for another tool (preferably Java) which would be more suitable.

Thanks
Andy

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users
    

applicationContext.xml (831 Bytes)

HelloWorld.java (437 Bytes)

geoserverlog.txt (12.4 KB)

pom.xml (821 Bytes)

Yeah... unfortunately I still don't quite understand the use case so i am not sure how useful my feedback was, my apologies. Some additional comments inline.

Michael Chisholm wrote:

In light of what Andrea has said regarding lack of an extension point for plugging in custom renderers, perhaps pursuing this is futile. I'm not sure if you are describing the dirty hackish way, whereas Andrea is describing the ideal way, or if you misunderstood what I wanted, and now agree it's not realistically possible. But I thought I'd at least try to get the basic plugin working from the tutorial you pointed me to.

It isn't working for me. First, one comment: the example code uses the Java servlet API, which is not an inherited dependency from the org.geoserver.community pom, so the plugin pom as given in the tutorial doesn't quite work. I had to add another dependency (see the attached pom file).

Interesting... the example depends on the main module which depends on the servlet api directly so there should be a transitive dependency. One thing you can do to debug is move to the root of the hello module and execute "mvn dependency:tree" and that will dump out the dependency tree.

The jar file is in my WEB-INF\lib directory:

[c:\programming\java\geoserver-1.7.1]dir webapps\geoserver\WEB-INF\lib\hello*

Volume in drive C is C-DISK Serial number is 24A2:50A4
Directory of C:\Programming\Java\geoserver-1.7.1\webapps\geoserver\WEB-INF\lib\hello*

1/13/2009 16:14 3,222 hello-0.0.1-SNAPSHOT.jar
         3,222 bytes in 1 file and 0 dirs 4,096 bytes allocated
21,512,957,952 bytes free

I access the URL: http://localhost:8080/geoserver/ows?request=sayHello&service=hello&version=1.0.0

The exception is: org.geoserver.platform.ServiceException: No service: ( hello )

(You can see the complete Jetty log output in another attached file.)

The jar file contents:

[c:\programming\java\geoserver-1.7.1]jar tf webapps\geoserver\WEB-INF\lib\hello-0.0.1-SNAPSHOT.jar
META-INF/
META-INF/MANIFEST.MF
org/
org/mitre/
org/mitre/geoserver/
org/mitre/geoserver/test/
org/mitre/geoserver/test/applicationContext.xml
org/mitre/geoserver/test/HelloWorld.class
META-INF/maven/
META-INF/maven/org.geoserver/
META-INF/maven/org.geoserver/hello/
META-INF/maven/org.geoserver/hello/pom.xml
META-INF/maven/org.geoserver/hello/pom.properties

Any idea what I'm doing wrong?

One thing I notice is the location of the applicationContext.xml file. Try moving it to the root of the package structure (parallel to "org").

Andy

Justin Deoliveira wrote:

Hi Michael,

Check out http://geoserver.org/display/GEOSDOC/3+A+Simple+PlugIn.

It is a simple example of writing a new service. You could write your own custom wms service. To save you some work you could use the existing WMS "request" objects. Check out the doc and let me know if it makes sense.

Also if you want to log into the geoserver irc channel freenode#geoserver I would be happy to discuss further.

-Justin

Michael Chisholm wrote:

I want to create a WMS layer which does not (directly) come from any canned shapefile or other service. I need to get at the parameters of the GetMap query, use them to query some geospatial data, and generate my own image which is based on that data. So I'm thinking I need a way to create some sort of plugin. E.g. I could create the raw image data, say as a Java BufferedImage object, and then pass that off to some other part of the system to convert to a data stream in some image file format, which is sent back to the client.

Reference docs on the website (http://geoserver.org/display/GEOSDOC/0+Extension+Points) list two extension points; neither quite matches what I need. I don't need new image formats or WMS operations. (Also, that web page prominently says it's no longer relevant... not sure what to make of that. Is the concept of extension points irrelevant, or are those particular extension points no longer relevant, or are they still there but the extension mechanism is implemented differently...?)

I am a newbie to GeoServer and to WMS's. Apologies if I am on the wrong list. In my mind, plugins sit somewhere in between development of geoserver itself (the dev list) and use and configuration of the webapp (the user list). Is GeoServer designed to be extended in the way I have described? How hard would it be to do this? I'm not even wedded to GeoServer, if anyone has a suggestion for another tool (preferably Java) which would be more suitable.

Thanks
Andy

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

This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users
    
------------------------------------------------------------------------

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword

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

_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

Justin Deoliveira wrote:

Yeah... unfortunately I still don't quite understand the use case so i am not sure how useful my feedback was, my apologies. Some additional comments inline.
  

I want to make a heatmap WMS layer. The layer is generated from dot data in a PostGIS database. If I were to make that into a layer directly, I would get maps of dots. I need to be able to change how the map is drawn so it generates heatmaps instead. I was hoping to be able to create some sort of plugin to Geoserver to do this, but it looks like the mechanism required to do this nicely isn't there yet.

Michael Chisholm wrote:
  

In light of what Andrea has said regarding lack of an extension point for plugging in custom renderers, perhaps pursuing this is futile. I'm not sure if you are describing the dirty hackish way, whereas Andrea is describing the ideal way, or if you misunderstood what I wanted, and now agree it's not realistically possible. But I thought I'd at least try to get the basic plugin working from the tutorial you pointed me to.

It isn't working for me. First, one comment: the example code uses the Java servlet API, which is not an inherited dependency from the org.geoserver.community pom, so the plugin pom as given in the tutorial doesn't quite work. I had to add another dependency (see the attached pom file).
    

Interesting... the example depends on the main module which depends on the servlet api directly so there should be a transitive dependency. One thing you can do to debug is move to the root of the hello module and execute "mvn dependency:tree" and that will dump out the dependency tree.
  

After commenting out the dependency I added, I get:

[INFO] [dependency:tree]
[INFO] org.geoserver:hello:jar:0.0.1-SNAPSHOT
[INFO] +- org.geoserver:platform:jar:1.7.0:compile
[INFO] | +- javax.media:jai_core:jar:1.1.3:compile
[INFO] | +- javax.media:jai_codec:jar:1.1.3:compile
[INFO] | \- javax.media:jai_imageio:jar:1.1:compile
[INFO] +- org.springframework:spring-beans:jar:2.5.5:compile
[INFO] | \- commons-logging:commons-logging:jar:1.0.3:compile (version managed from 1.1.1)
[INFO] +- org.springframework:spring-core:jar:2.5.5:compile
[INFO] +- org.springframework:spring-context:jar:2.5.5:compile
[INFO] | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- org.springframework:spring-webmvc:jar:2.5.5:compile
[INFO] | +- org.springframework:spring-context-support:jar:2.5.5:compile
[INFO] | \- org.springframework:spring-web:jar:2.5.5:compile
[INFO] +- org.geotools:gt-api:jar:2.5.1:compile
[INFO] | +- com.vividsolutions:jts:jar:1.9:compile
[INFO] | \- org.geotools:gt-referencing:jar:2.5.1:compile
[INFO] | +- java3d:vecmath:jar:1.3.1:compile
[INFO] | +- commons-pool:commons-pool:jar:1.3:compile
[INFO] | \- org.geotools:gt-metadata:jar:2.5.1:compile
[INFO] | +- org.opengis:geoapi:jar:2.2-SNAPSHOT:compile (version managed from 2.2-M1)
[INFO] | \- net.java.dev.jsr-275:jsr-275:jar:1.0-beta-2:compile
[INFO] +- org.geotools:gt-main:jar:2.5.1:compile
[INFO] | +- jdom:jdom:jar:1.0:compile
[INFO] | \- commons-beanutils:commons-beanutils:jar:1.7.0:compile
[INFO] \- junit:junit:jar:3.8.2:test

The java servlet API isn't there. I also looked at the community pom to see if it was there, and I didn't see it there either. Just today noticed though, that the community artifact itself has a parent (geoserver) and that does actually list the servlet-api as a dependency (in <dependencyManagement>). I was reading the maven docs, and I think that dependencies listed in <dependencyManagement> are not automatically added as dependencies of child projects. A quote from http://maven.apache.org/ref/current/maven-model/maven.html#class_dependencyManagement:

'The dependencies specified here are not used until they are referenced in a POM within the group. This allows the specification of a "standard" version for a particular dependency. '

So that means having the servlet API in <dependencyManagement> only allows me to omit the version number in my pom, not omit the dependency completely.

The jar file is in my WEB-INF\lib directory:

[c:\programming\java\geoserver-1.7.1]dir webapps\geoserver\WEB-INF\lib\hello*

Volume in drive C is C-DISK Serial number is 24A2:50A4
Directory of C:\Programming\Java\geoserver-1.7.1\webapps\geoserver\WEB-INF\lib\hello*

1/13/2009 16:14 3,222 hello-0.0.1-SNAPSHOT.jar
         3,222 bytes in 1 file and 0 dirs 4,096 bytes allocated
21,512,957,952 bytes free

I access the URL: http://localhost:8080/geoserver/ows?request=sayHello&service=hello&version=1.0.0

The exception is: org.geoserver.platform.ServiceException: No service: ( hello )

(You can see the complete Jetty log output in another attached file.)

The jar file contents:

[c:\programming\java\geoserver-1.7.1]jar tf webapps\geoserver\WEB-INF\lib\hello-0.0.1-SNAPSHOT.jar
META-INF/
META-INF/MANIFEST.MF
org/
org/mitre/
org/mitre/geoserver/
org/mitre/geoserver/test/
org/mitre/geoserver/test/applicationContext.xml
org/mitre/geoserver/test/HelloWorld.class
META-INF/maven/
META-INF/maven/org.geoserver/
META-INF/maven/org.geoserver/hello/
META-INF/maven/org.geoserver/hello/pom.xml
META-INF/maven/org.geoserver/hello/pom.properties

Any idea what I'm doing wrong?
    
One thing I notice is the location of the applicationContext.xml file. Try moving it to the root of the package structure (parallel to "org").
  

Ah, that was it. The example did not put the HelloWorld class in a package like I did, so it was ambiguous where the context xml file should go if your class has a package (the typical case). I think the example should use a package, to clear this up.

Andy

I want to make a heatmap WMS layer. The layer is generated from dot data in a PostGIS database. If I were to make that into a layer directly, I would get maps of dots. I need to be able to change how the map is drawn so it generates heatmaps instead. I was hoping to be able to create some sort of plugin to Geoserver to do this, but it looks like the mechanism required to do this nicely isn't there yet.

Thanks for the description, i think i understand now.

So yeah, while the system is ideally set up to allow this... i still think it might be possible though with a custom service... but yeah, definitely not trivial.

Understanding the problem it seems that this is more something that fits into the realm of WPS... which is something we have been working on but still experimental.

Michael Chisholm wrote:
  

In light of what Andrea has said regarding lack of an extension point for plugging in custom renderers, perhaps pursuing this is futile. I'm not sure if you are describing the dirty hackish way, whereas Andrea is describing the ideal way, or if you misunderstood what I wanted, and now agree it's not realistically possible. But I thought I'd at least try to get the basic plugin working from the tutorial you pointed me to.

It isn't working for me. First, one comment: the example code uses the Java servlet API, which is not an inherited dependency from the org.geoserver.community pom, so the plugin pom as given in the tutorial doesn't quite work. I had to add another dependency (see the attached pom file).
    

Interesting... the example depends on the main module which depends on the servlet api directly so there should be a transitive dependency. One thing you can do to debug is move to the root of the hello module and execute "mvn dependency:tree" and that will dump out the dependency tree.
  

After commenting out the dependency I added, I get:

[INFO] [dependency:tree]
[INFO] org.geoserver:hello:jar:0.0.1-SNAPSHOT
[INFO] +- org.geoserver:platform:jar:1.7.0:compile
[INFO] | +- javax.media:jai_core:jar:1.1.3:compile
[INFO] | +- javax.media:jai_codec:jar:1.1.3:compile
[INFO] | \- javax.media:jai_imageio:jar:1.1:compile
[INFO] +- org.springframework:spring-beans:jar:2.5.5:compile
[INFO] | \- commons-logging:commons-logging:jar:1.0.3:compile (version managed from 1.1.1)
[INFO] +- org.springframework:spring-core:jar:2.5.5:compile
[INFO] +- org.springframework:spring-context:jar:2.5.5:compile
[INFO] | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- org.springframework:spring-webmvc:jar:2.5.5:compile
[INFO] | +- org.springframework:spring-context-support:jar:2.5.5:compile
[INFO] | \- org.springframework:spring-web:jar:2.5.5:compile
[INFO] +- org.geotools:gt-api:jar:2.5.1:compile
[INFO] | +- com.vividsolutions:jts:jar:1.9:compile
[INFO] | \- org.geotools:gt-referencing:jar:2.5.1:compile
[INFO] | +- java3d:vecmath:jar:1.3.1:compile
[INFO] | +- commons-pool:commons-pool:jar:1.3:compile
[INFO] | \- org.geotools:gt-metadata:jar:2.5.1:compile
[INFO] | +- org.opengis:geoapi:jar:2.2-SNAPSHOT:compile (version managed from 2.2-M1)
[INFO] | \- net.java.dev.jsr-275:jsr-275:jar:1.0-beta-2:compile
[INFO] +- org.geotools:gt-main:jar:2.5.1:compile
[INFO] | +- jdom:jdom:jar:1.0:compile
[INFO] | \- commons-beanutils:commons-beanutils:jar:1.7.0:compile
[INFO] \- junit:junit:jar:3.8.2:test

The java servlet API isn't there. I also looked at the community pom to see if it was there, and I didn't see it there either. Just today noticed though, that the community artifact itself has a parent (geoserver) and that does actually list the servlet-api as a dependency (in <dependencyManagement>). I was reading the maven docs, and I think that dependencies listed in <dependencyManagement> are not automatically added as dependencies of child projects. A quote from http://maven.apache.org/ref/current/maven-model/maven.html#class_dependencyManagement:

Seems the dependency on org.geoserver.main is missing, there is only one on platform, so understandable it is not there. Are you sure your pom has a dependency like:

  <dependency>
       <groupId>org.geoserver</groupId>
       <artifactId>main</artifactId>
     </dependency>

'The dependencies specified here are not used until they are referenced in a POM within the group. This allows the specification of a "standard" version for a particular dependency. '

So that means having the servlet API in <dependencyManagement> only allows me to omit the version number in my pom, not omit the dependency completely.

The jar file is in my WEB-INF\lib directory:

[c:\programming\java\geoserver-1.7.1]dir webapps\geoserver\WEB-INF\lib\hello*

Volume in drive C is C-DISK Serial number is 24A2:50A4
Directory of C:\Programming\Java\geoserver-1.7.1\webapps\geoserver\WEB-INF\lib\hello*

1/13/2009 16:14 3,222 hello-0.0.1-SNAPSHOT.jar
         3,222 bytes in 1 file and 0 dirs 4,096 bytes allocated
21,512,957,952 bytes free

I access the URL: http://localhost:8080/geoserver/ows?request=sayHello&service=hello&version=1.0.0

The exception is: org.geoserver.platform.ServiceException: No service: ( hello )

(You can see the complete Jetty log output in another attached file.)

The jar file contents:

[c:\programming\java\geoserver-1.7.1]jar tf webapps\geoserver\WEB-INF\lib\hello-0.0.1-SNAPSHOT.jar
META-INF/
META-INF/MANIFEST.MF
org/
org/mitre/
org/mitre/geoserver/
org/mitre/geoserver/test/
org/mitre/geoserver/test/applicationContext.xml
org/mitre/geoserver/test/HelloWorld.class
META-INF/maven/
META-INF/maven/org.geoserver/
META-INF/maven/org.geoserver/hello/
META-INF/maven/org.geoserver/hello/pom.xml
META-INF/maven/org.geoserver/hello/pom.properties

Any idea what I'm doing wrong?
    

One thing I notice is the location of the applicationContext.xml file. Try moving it to the root of the package structure (parallel to "org").
  

Ah, that was it. The example did not put the HelloWorld class in a package like I did, so it was ambiguous where the context xml file should go if your class has a package (the typical case). I think the example should use a package, to clear this up.

Yeah, good call, that tutorial needs updating as it is... i will throw that on the list. Thanks.

Andy

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

Michael Chisholm ha scritto:

Andrea Aime wrote:

Michael Chisholm ha scritto:
  

I need the plugin because although the data is point data from a PostGIS database, I'm not just going to draw a map with a bunch of dots. That's where my customization comes in. I can take that data and draw anything I want. In my case, I want to draw a "heatmap", which is a blobby looking thing that is brighter where there are more dots and dimmer where there are fewer.

Thinking about this, I'm really wondering if you cannot get something
similar using the standard SLD driven renderer.

I guess you have points in your dataset, right? If so, wouldn't you
get close by drawing each point as a circle, translucent, red. Where
circles do overlap the color gets denser and denser, eventually becoming
opaque.

Sorry if that is not really a heatmap, just never drawn/seen one
Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Andrea Aime wrote:

Michael Chisholm ha scritto:
  

Andrea Aime wrote:
    

Michael Chisholm ha scritto:
  

I need the plugin because although the data is point data from a PostGIS database, I'm not just going to draw a map with a bunch of dots. That's where my customization comes in. I can take that data and draw anything I want. In my case, I want to draw a "heatmap", which is a blobby looking thing that is brighter where there are more dots and dimmer where there are fewer.
        
Thinking about this, I'm really wondering if you cannot get something
similar using the standard SLD driven renderer.

I guess you have points in your dataset, right? If so, wouldn't you
get close by drawing each point as a circle, translucent, red. Where
circles do overlap the color gets denser and denser, eventually becoming
opaque.

Sorry if that is not really a heatmap, just never drawn/seen one
Cheers
Andrea
  

I think your idea is close to what I want. Overlapping circles might get a similar effect, but it would probably not achieve the colorful smoothed effect I am looking for.

I made a little heatmap sample image and posted it at:

http://img37.picoodle.com/img/img37/3/1/16/f_heatmapm_2dc0c72.jpg

It is built using simple point data and some other parameters which control size and brightness. Also, I want to implement other effects, e.g. combining multiple heatmaps together (as an intersection). I think it's more complex than simply drawing translucent circles.

Andy

Justin Deoliveira wrote:

I want to make a heatmap WMS layer. The layer is generated from dot data in a PostGIS database. If I were to make that into a layer directly, I would get maps of dots. I need to be able to change how the map is drawn so it generates heatmaps instead. I was hoping to be able to create some sort of plugin to Geoserver to do this, but it looks like the mechanism required to do this nicely isn't there yet.
    

Thanks for the description, i think i understand now.

So yeah, while the system is ideally set up to allow this... i still think it might be possible though with a custom service... but yeah, definitely not trivial.

Understanding the problem it seems that this is more something that fits into the realm of WPS... which is something we have been working on but still experimental.
  

I hadn't heard of a WPS, but I looked it up to see what it was. I'd have to read more to know if it's capable of doing what I want. See

http://img37.picoodle.com/img/img37/3/1/16/f_heatmapm_2dc0c72.jpg

for an example heatmap I threw together.

  

Michael Chisholm wrote:
  

In light of what Andrea has said regarding lack of an extension point for plugging in custom renderers, perhaps pursuing this is futile. I'm not sure if you are describing the dirty hackish way, whereas Andrea is describing the ideal way, or if you misunderstood what I wanted, and now agree it's not realistically possible. But I thought I'd at least try to get the basic plugin working from the tutorial you pointed me to.

It isn't working for me. First, one comment: the example code uses the Java servlet API, which is not an inherited dependency from the org.geoserver.community pom, so the plugin pom as given in the tutorial doesn't quite work. I had to add another dependency (see the attached pom file).
    

Interesting... the example depends on the main module which depends on the servlet api directly so there should be a transitive dependency. One thing you can do to debug is move to the root of the hello module and execute "mvn dependency:tree" and that will dump out the dependency tree.
  

After commenting out the dependency I added, I get:

[INFO] [dependency:tree]
[INFO] org.geoserver:hello:jar:0.0.1-SNAPSHOT
[INFO] +- org.geoserver:platform:jar:1.7.0:compile
[INFO] | +- javax.media:jai_core:jar:1.1.3:compile
[INFO] | +- javax.media:jai_codec:jar:1.1.3:compile
[INFO] | \- javax.media:jai_imageio:jar:1.1:compile
[INFO] +- org.springframework:spring-beans:jar:2.5.5:compile
[INFO] | \- commons-logging:commons-logging:jar:1.0.3:compile (version managed from 1.1.1)
[INFO] +- org.springframework:spring-core:jar:2.5.5:compile
[INFO] +- org.springframework:spring-context:jar:2.5.5:compile
[INFO] | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- org.springframework:spring-webmvc:jar:2.5.5:compile
[INFO] | +- org.springframework:spring-context-support:jar:2.5.5:compile
[INFO] | \- org.springframework:spring-web:jar:2.5.5:compile
[INFO] +- org.geotools:gt-api:jar:2.5.1:compile
[INFO] | +- com.vividsolutions:jts:jar:1.9:compile
[INFO] | \- org.geotools:gt-referencing:jar:2.5.1:compile
[INFO] | +- java3d:vecmath:jar:1.3.1:compile
[INFO] | +- commons-pool:commons-pool:jar:1.3:compile
[INFO] | \- org.geotools:gt-metadata:jar:2.5.1:compile
[INFO] | +- org.opengis:geoapi:jar:2.2-SNAPSHOT:compile (version managed from 2.2-M1)
[INFO] | \- net.java.dev.jsr-275:jsr-275:jar:1.0-beta-2:compile
[INFO] +- org.geotools:gt-main:jar:2.5.1:compile
[INFO] | +- jdom:jdom:jar:1.0:compile
[INFO] | \- commons-beanutils:commons-beanutils:jar:1.7.0:compile
[INFO] \- junit:junit:jar:3.8.2:test

The java servlet API isn't there. I also looked at the community pom to see if it was there, and I didn't see it there either. Just today noticed though, that the community artifact itself has a parent (geoserver) and that does actually list the servlet-api as a dependency (in <dependencyManagement>). I was reading the maven docs, and I think that dependencies listed in <dependencyManagement> are not automatically added as dependencies of child projects. A quote from http://maven.apache.org/ref/current/maven-model/maven.html#class_dependencyManagement:
    
Seems the dependency on org.geoserver.main is missing, there is only one on platform, so understandable it is not there. Are you sure your pom has a dependency like:

  <dependency>
       <groupId>org.geoserver</groupId>
       <artifactId>main</artifactId>
     </dependency>
  

Argh... you're right. I missed that dependency, and it's even in the tutorial pom! That pulled in the servlet API artifact... and a *ton* of other stuff too. Maybe I was better off with just the servlet API dependency... :slight_smile:

Thanks
Andy