Thanks Andy-
GWS, Slope, Aspect - a lot of good stuff in there! Which class is used to
create a density surface? I must have missed it at first glance.
Also, does your density calculation use a Gaussian kernel similar to the one
used in spatial analyst?
http://www.quantdec.com/SYSEN597/GTKAV/section9/density.htm
Thanks,
Peter
________________________________
From: Andy Turner <[email protected]>
To: 'Peter Borissow' <[email protected]>; Michael Bedward
<[email protected]>
Cc: geotools-gt2-users <[email protected]>
Sent: Tuesday, November 22, 2011 12:41 PM
Subject: RE: [Geotools-gt2-users] Kernel Density Estimation - KDE
Hi Peter, Michael, geotools-gt2-users,
I developed some Java for creating density surfaces (and other statistics). It
was based on the original GeoTools Raster class and has the LGPL license. Sorry
I did not managed to re-integrate my work back into GeoTools.
The main web page for my efforts which I called Grids can be found via the
following URL:
http://www.geog.leeds.ac.uk/people/a.turner/src/andyt/java/grids/
One of the example uses of Grids was to produce different statistics (output as
rasters) based on the generalisation of point data. These statistics could be
distance weighted and draw in values across a range of scales. Essentially it
worked with distance weighting. There were statistics based on a single set or
values of points and others based on two sets or values of points. I didn’t get
any further than that.
I am happy to revisit my code, adapt an example to use your data and release a
new version if you want.
Andy
http://www.geog.leeds.ac.uk/people/a.turner/
From:Peter Borissow [mailto:[email protected]]
Sent: 22 November 2011 12:45
To: Michael Bedward
Cc: geotools-gt2-users
Subject: Re: [Geotools-gt2-users] Kernel Density Estimation - KDE
Hello Michael-
Thanks for your response. I *think* the way to go is to start off with a
raster surface (GridCoverage2D) and iterate through all the pixels in the grid
and measure distances to all the neighboring points (points that fall within a
certain distance of the pixel). Knowing relative distances to the neighboring
points, we can apply a simple calculation to assign a weight to the given
pixel.
Can you please point me to an example of how to iterate through all the pixels
in an empty GridCoverage2D, get the coordinate for that pixel, and assign a
value for the pixel?
Many Thanks,
Peter
________________________________
From:Michael Bedward <[email protected]>
To: Peter Borissow <[email protected]>
Cc: Georges Tony <[email protected]>; geotools-gt2-users
<[email protected]>
Sent: Tuesday, November 22, 2011 3:47 AM
Subject: Re: [Geotools-gt2-users] Kernel Density Estimation - KDE
Hello Peter,
> That's right. I want to pass in a collection of points and radius and get
> back a raster image (GridCoverage2D). I envision something as simple as
> this:
>
> public GridCoverage2D getDensityMap(java.util.ArrayList<Point> points,
> double radius, String units){
> }
Ah yes, simple is beautiful.
> Does something like that exist in GeoTools today?
No. At least, not yet.
One way to do it would be to first rasterize your point features and
then run a convolution over the resulting grid coverage. For the first
the step you can use the VectorToRasterProcess class and its static
process method. You'll find this is in the unsupported gt-process
module in GeoTools version 2.7.x or the gt-process-raster module in
GeoTools 8.x (because the module is unsupported it is not in the
online javadocs). For the second step there is a Convolve operation
which takes a kernel and applies it to a grid coverage:
http://docs.geotools.org/latest/javadocs/org/geotools/coverage/processing/operation/Convolve.html
There are some gotchas with the above method. The first is that the
rasterizing process expects a numeric feature attribute to use for
corresponding raster values. If you want to generate a heat map based
on point frequency within a neighbourhood, which I assume you do, you
will need an attribute with the value 1 for all features.
Alternatively you could hack the process code. A second, more serious
complication is that if multiple points fall into a single grid cell
only the last one processed contributes to the raster value. Depending
on the nature of your data, it may be possible to avoid this by
specifying a sufficiently fine grid resolution when rasterizing so
long as that doesn't result in blowing out your system's memory. Once
again, you could hack the process code to get around this.
Personally, I'd cheat and create a raster image from the feature data
"by hand" where cell values are point frequency; convolve the raster
using JAI or JAITools to create the density image; and finally turn
that into a GridCoverage2D. If you want to try that, let me know and
I'll rustle up some example code. Meanwhile, others here might have
better, simpler, more elegant suggestions.
Michael------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users