M, thanks for the code. in it you say: vertices[k++] = new Coordinate(x, y);
where x and y are of type double. however, since my gps gives me data in the form of 144 12.345 where the 144 is degrees and the 12.345 is minutes, how do i create coordinates if the constructor takes doubles? On 20/01/2009, at 8:16 PM, Michael Bedward wrote: > Firstly, I'm not sure what data format(s) your gps exports, but if GPX > is one of them I suggest you have a look at the new gpx package... > http://javadoc.geotools.fr/2.5/org/geotools/data/gpx/package-summary.html > > I haven't used this package but it may well do a lot of what you need. > > Meanwhile, if you are working with raw data, creating polygons "by > hand" each of your farm buildings from corner/vertex coords is very > straightforward... > > /// warning - mixture of pseudo code and java ! > > GeometryFactory gf = new GeometryFactory(); > List<Polygon> polys = new ArrayList<Polygon>(); > for each building... { > int nv = ... numer of vertices in this building > Coordinate[] vertices = new Coordinate[nv + 1] > int k = 0; > for each vertex with ordinates x, y { > vertices[k++] = new Coordinate(x, y); > } > vertices[k] = vertices[0]; // end vertex == start vertex to > 'close' polygon > > Polygon poly = new > gf.createPolygon(gf.createLinearRing(vertices), null); > polys.add(poly); > } > > For GeometryFactory, Polygon and Coordinate classes see the docs at: > http://tsusiatsoftware.net/jts/javadoc/index.html > > Michael > ------------------------------------------------------------------------------ This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword _______________________________________________ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users