Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Rightclick on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: ari fainchtein <artwork@le...>  20090119 04:57:02

Hello, I just started playing with JTS and Geotools. The question I have is, is I have a GPS unit that give info as Long and Lat with values as S144 23.456, E 28 88.123, how do I create coordinates to create geometries in JTS? thanks 
From: Michael Bedward <michael.bedward@gm...>  20090119 08:05:01

Hi Ari, Are you asking about some aspect of converting from latlong to a rectangular coordinate system prior to creating geometries ? (I saw your earlier question about lat/long > utm) Are you wondering how to deal with the specific format of the values from your GPS ? (in which case, what does 28 88.123 mean ?) Sorry if I'm missing something obvious... Michael 
From: ari fainchtein <artwork@le...>  20090119 14:44:26

Yes. I want to write code so that I can walk around my farm with a gps unit, locate coordinates for every building to create a 2D diagram. My gps unit gives me values like S37 28.123 it means 37degrees 28.123. Since my app is web based, I need to be able to generate diagrams in an XY coordinate system. Therefore the question on how to create a geometry from data coming from a gps unit. Any suggestions on how to do that? On 19/01/2009, at 0:04, "Michael Bedward" <michael.bedward@...> wrote: > Hi Ari, > > Are you asking about some aspect of converting from latlong to a > rectangular coordinate system prior to creating geometries ? (I saw > your earlier question about lat/long > utm) > > Are you wondering how to deal with the specific format of the values > from your GPS ? > (in which case, what does 28 88.123 mean ?) > > Sorry if I'm missing something obvious... > > Michael > 
From: Michael Bedward <michael.bedward@gm...>  20090120 03:17:35

Hi Ari, Well, before talking code  can you configure you gps to record UTM coords ? I've only used a few but they all allowed setting the datum and projection. Michael 2009/1/20 ari fainchtein <artwork@...>: > Yes. I want to write code so that I can walk around my farm with a gps unit, > locate coordinates for every building to create a 2D diagram. My gps unit > gives me values like S37 28.123 it means 37degrees 28.123. Since my app is > web based, I need to be able to generate diagrams in an XY coordinate > system. Therefore the question on how to create a geometry from data coming > from a gps unit. Any suggestions on how to do that? > > On 19/01/2009, at 0:04, "Michael Bedward" <michael.bedward@...> wrote: > >> Hi Ari, >> >> Are you asking about some aspect of converting from latlong to a >> rectangular coordinate system prior to creating geometries ? (I saw >> your earlier question about lat/long > utm) >> >> Are you wondering how to deal with the specific format of the values >> from your GPS ? >> (in which case, what does 28 88.123 mean ?) >> >> Sorry if I'm missing something obvious... >> >> Michael >> > 
From: ari fainchtein <artwork@le...>  20090120 15:12:54

Thanks for that. Even if my garmin61 gives me utm, how do I create polygons from utm or latitude long ? On 19/01/2009, at 21:17, "Michael Bedward" <michael.bedward@...> wrote: > Hi Ari, > > Well, before talking code  can you configure you gps to record UTM > coords ? I've only used a few but they all allowed setting the datum > and projection. > > Michael > > > 2009/1/20 ari fainchtein <artwork@...>: >> Yes. I want to write code so that I can walk around my farm with a >> gps unit, >> locate coordinates for every building to create a 2D diagram. My >> gps unit >> gives me values like S37 28.123 it means 37degrees 28.123. Since my >> app is >> web based, I need to be able to generate diagrams in an XY >> coordinate >> system. Therefore the question on how to create a geometry from >> data coming >> from a gps unit. Any suggestions on how to do that? >> >> On 19/01/2009, at 0:04, "Michael Bedward" >> <michael.bedward@...> wrote: >> >>> Hi Ari, >>> >>> Are you asking about some aspect of converting from latlong to a >>> rectangular coordinate system prior to creating geometries ? (I saw >>> your earlier question about lat/long > utm) >>> >>> Are you wondering how to deal with the specific format of the values >>> from your GPS ? >>> (in which case, what does 28 88.123 mean ?) >>> >>> Sorry if I'm missing something obvious... >>> >>> Michael >>> >> > 
From: Michael Bedward <michael.bedward@gm...>  20090121 02:16:28

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/packagesummary.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 
From: ari fainchtein <artwork@le...>  20090121 23:22:25

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/packagesummary.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 > 
From: Michael Bedward <michael.bedward@gm...>  20090121 23:54:48

> 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? This is how I would do it... double toDecimalDeg(double deg, double min) { int sign = deg < 0 ? 1 : 1; double decDeg = Math.abs(deg) + min / 60; return decDeg * sign; } Michael 