I did a bit more research on this and discovered the following:

- when I set the output format to "kml", the resulting polygons are
_not_ clipped to the bounding box specified by the bbox argument
- version 2.3 of geotools had a Polygon class with a clip method, but
the class does not exist in 2.4.
(http://udig.refractions.net/files/docs/api-geotools/org/geotools/renderer/geom/Polygon.html)

I am beginning to think that Geotools does _not_ clip the polygons
directly, but instead leaves it up to the Graphics class to clip the
resulting image. I'm going to stepping through the code in the
debugger to learn if this is true.

In the meantime I have been researching various polygon clipping
algorithms. I have been surprised to not find such a thing in a
standard library (e.g. Java2D). I did find Area.intersect(), but have
found it to be 10x slower than Geotools. I'm guessing it is slow
because it needs to handle the general case of any shaped polygon
intersecting with any shaped polygon. In my case, one of the polygons
is always a square.

On Fri, Jul 4, 2008 at 1:13 PM, Mike Bresnahan <[EMAIL PROTECTED]> wrote:
> Given a WMS request for a 256x256 map tile and vector data stored in
> Oracle Spatial, I am trying to understand how GeoTools crops the
> image. Judging by some database tracing, GeoTools does not appear to
> use the sdo_intersection function. Instead it simply queries all
> polygons that have any interaction with the bounding box of the map
> tile (via the sdo_relate operator). This will result in a lot of
> vertices outside the bounding box of the map tile. How does GeoTools
> transform this into just the vertices present on the map tile and/or
> where in the source code does this happen?
>
> The reason I ask, is because I am trying to implement a high
> throughput map tiler to transform some very large polygons into
> smaller polygons of the right size for a map tile. I have tried to do
> this by using sdo_intersection to compute the intersection of the
> large polygons with the bounding box of the map tile, but it is very
> very slow. I have seen a single intersection of a tile bounding box
> and a 40,000 vertex polygon take 11 seconds. Since I have to perform
> over 100,000 of these operations, I need to find something faster. I
> know its possible to do this faster, because GeoTools creates map
> tiles in less than 11 seconds on the same data. But so far I have not
> been able to find the magic code in the source I downloaded.
>
> Any help would be greatly appreciated.
>

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to