## jts-topo-suite-user

 [Jts-topo-suite-user] ShapeReader fails to create geometry From: JARRILUCEA@YAHOO.COM - 2013-04-27 03:23:42 Attachments: Message as HTML ```Question 1: In the below sample the rectangle (rect) coords are not the same as the geometry object created by ShareReader. The geometry rectangle (geoshape) appears to be symmetrical about the x axis. What am I missing? Question 2: Is there anyway to compute the horizontal and vertical distance between two points? Thanks for your help. *********************code***************************** package flatness; import com.vividsolutions.jts.awt.*; import com.vividsolutions.jts.geom.*; import java.awt.geom.Rectangle2D; import java.awt.Shape; public class Flatness { private GeometryFactory gf = new GeometryFactory(); Flatness(){ Geometry geoshape; Shape sh; Rectangle2D rect = new Rectangle2D.Double(); //sh = (Shape)rect; rect.setFrameFromDiagonal(0, 0, 100, 100); geoshape = ShapeReader.read(rect, 0.01, gf);     }     public static void main(String[] args) {               Flatness fl = new Flatness();     } } ```
 Re: [Jts-topo-suite-user] ShapeReader fails to create geometry From: Martin Davis - 2013-04-27 04:17:19 Attachments: Message as HTML ```1) The geometry returned by ShapeReader is inverted in the Y direction. This is by design, because the coordinate system for Java2D shapes is usually screen coordinates, which have Y increasing *down* the screen. The inversion is done in the static read method of ShapeReader. 2) Perhaps double hDist = p1.x - p0.x; double vDist = p1.y - p0.y; On 4/26/2013 8:23 PM, JARRILUCEA@... wrote: > Question 1: In the below sample the rectangle (rect) coords are not > the same as the geometry object created by ShareReader. The geometry > rectangle (geoshape) appears to be symmetrical about the x axis. What > am I missing? > > Question 2: Is there anyway to compute the horizontal and vertical > distance between two points? > > Thanks for your help. > > > > > *********************code***************************** > > package flatness; > > import com.vividsolutions.jts.awt.*; > import com.vividsolutions.jts.geom.*; > import java.awt.geom.Rectangle2D; > import java.awt.Shape; > > > public class Flatness { > private GeometryFactory gf = new GeometryFactory(); > > Flatness(){ > Geometry geoshape; > Shape sh; > Rectangle2D rect = new Rectangle2D.Double(); > //sh = (Shape)rect; > > rect.setFrameFromDiagonal(0, 0, 100, 100); > > geoshape = ShapeReader.read(rect, 0.01, gf); > > > > } > > > public static void main(String[] args) { > > Flatness fl = new Flatness(); > } > } > > > > > ------------------------------------------------------------------------------ > Try New Relic Now & We'll Send You this Cool Shirt > New Relic is the only SaaS-based application performance monitoring service > that delivers powerful full stack analytics. Optimize and monitor your > browser, app, & servers with just a few lines of code. Try New Relic > and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr > > > _______________________________________________ > Jts-topo-suite-user mailing list > Jts-topo-suite-user@... > https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user ```