On Tue, Mar 4, 2014 at 8:40 AM, Jody Garnett <[email protected]> wrote:

> The libraries are not that different, GEOS is a port of JTS after all.
> You may wish to ask on the JTS mailing list for details on how buffer and
> centroid can be used.
>

Jody is spot on, aks on the JTS mailing list.
And yeah, I can confirm it's not specific to WPS, here is a sample self
contained program:

import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.Point;
import com.vividsolutions.jts.io.ParseException;
import com.vividsolutions.jts.io.WKTReader;


public class BufferUnbuffer {

    public static void main(String[] args) throws ParseException {
        Geometry point = new WKTReader().read(" POINT(12 42)");
        Geometry buffer = point.buffer(0.0001);
        Point centroid = buffer.getCentroid();
        System.out.println(centroid);
    }
}

The output is: POINT (12 41.99999999999999)

If I had to venture a guess, this is due to Java using IEEE floating point
numbers to the letter,
whilst C compilers have them use whatever precision is available in the
native CPU, and if memory
serves me right, this results in more precision bits added to the
computation (80bits vs 64bits)

Hum... according to this page, Java can still perform calculations with 80
bits, but the final
representation is 64:
http://en.wikipedia.org/wiki/Strictfp

Cheers
Andrea



-- 
== Our support, Your Success! Visit http://opensdi.geo-solutions.it for
more information ==

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39  339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------
------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to