Jürgen Jacob ha scritto: > Andrea Aime schrieb: >> Jürgen Jacob ha scritto: >>> Dear all, >>> >>> is it possible to buffer Points into Polygons? I've a shapefile with >>> point features and I want to create a buffer around them. How can I >>> do this? The CRS is WGS84 and the buffer should be 50m. The resultung >>> geometry objects will be polygon, or? >> >> JTS provides a buffer operation, but that works only in cartesian space, >> it won't help you in your specific case. >> I see two practical solutions to your problem: >> - if the points are located in a limited area, reproject them to >> a metric projection that has low deformation over the area >> of interest (utm, lambert, whatever), do the buffers with JTS, >> reproject the polygons you get back to WGS84. >> This approach works with every kind of geometry >> - if the points are located in a large area, use GeodeticCalculator >> to create the buffers manually. Set the starting point at one of >> the point that needs buffering, and ask for the coordinates of >> a point 50m away, with an azimut of 0. Then use an azimuth or >> 30, 60, 90 and so on, connect the resulting point, and there >> you have the shell of the buffer polygon. Repeat for all points >> and you're done. >> >> Hope this helps >> Cheers >> Andrea > > Thanks a lot!! > > I'll check what will be the best solution for my application. How do I > reproject geometries?
The quick way would be: MathTransform tx = CRS.findMathTransform(CRSFrom, CRSTo, true); Geometry transformed = JTS.transform(geom, transform) The above method works fine only if the lines making up the geometry are not too long, as they won't be split into smaller parts during the reprojection (think reprojecting a long parallel portion over to Lambert, the result would be a curve, but to get an approximation of that you would have to densify the starting straight line, as the reprojection occors only on vertices). Cheers Andrea -- Andrea Aime OpenGeo - http://opengeo.org Expert service straight from the developers. ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Geotools-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-devel
