## geotools-gt2-users

 [Geotools-gt2-users] How To move a point of X meters. From: elephant2001 - 2011-04-26 14:14:05 ```Hi all, I'm newbie on GIS and on GeoTools ( and I'm not very good in math).... I need to do this: - I have a position in geo coordinates WGS84 (for example: 45.4644, 9.1908); - I have a "distance" in meters (i.e. 200 m) I would like to move my position about 200 m to East. So my destination point should be 45.4644, (9.1908 + 200m). How I can do this? I try to see the class GeodeticCalculator but I am not be able to use it. I defined a point as : GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(null); Point createPoint = geometryFactory.createPoint(new Coordinate( 9.1908, 45.4644)); Could you provide me some examples? Thanks in advance. El -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/How-To-move-a-point-of-X-meters-tp6305838p6305838.html Sent from the geotools-gt2-users mailing list archive at Nabble.com. ```
 Re: [Geotools-gt2-users] How To move a point of X meters. From: Andrea Aime - 2011-04-26 20:00:14 ```On Tue, Apr 26, 2011 at 4:13 PM, elephant2001 wrote: > Hi all, > I'm newbie on GIS and on GeoTools ( and I'm not very good in math).... > > > I need to do this: > - I have a position in geo coordinates WGS84 (for example: 45.4644, 9.1908); > - I have a "distance" in meters (i.e. 200 m) > > I would like to move my position about 200 m to East. So my destination > point should be  45.4644, (9.1908 + 200m). > > How I can do this? > > I try to see the class GeodeticCalculator but I am not be able to use it. > > I defined a point as : >        GeometryFactory geometryFactory = > JTSFactoryFinder.getGeometryFactory(null); >        Point createPoint = geometryFactory.createPoint(new Coordinate( 9.1908, > 45.4644)); > > > Could you provide me some examples? Here we go: import java.awt.geom.Point2D; import org.geotools.referencing.GeodeticCalculator; public class MovePoint { public static void main(String[] args) { GeodeticCalculator calc = new GeodeticCalculator(); // mind, this is lon/lat calc.setStartingGeographicPoint(45.4644, 9.1908); calc.setDirection(90, 200); Point2D dest = calc.getDestinationGeographicPoint(); System.out.println("Longitude: " + dest.getX() + " Latitude: " + dest.getY()); } } Reference for the azimuth value: http://en.wikipedia.org/wiki/Azimuth Also mind GeodeticCalculator works in lon/lat order (as most data source do as well). Cheers Andrea -- ------------------------------------------------------- Ing. Andrea Aime GeoSolutions S.A.S. Tech lead Via Poggio alle Viti 1187 55054  Massarosa (LU) Italy phone: +39 0584 962313 fax:      +39 0584 962313 http://www.geo-solutions.it http://geo-solutions.blogspot.com/ http://www.youtube.com/user/GeoSolutionsIT http://www.linkedin.com/in/andreaaime http://twitter.com/geowolf ------------------------------------------------------- ```
 Re: [Geotools-gt2-users] How To move a point of X meters. From: elephant2001 - 2011-04-27 07:20:09 ```Thanks a lot. So Is the parameter "distance" of the method setDirection expressed in meters? In the Javadoc isn't written... -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/How-To-move-a-point-of-X-meters-tp6305838p6308337.html Sent from the geotools-gt2-users mailing list archive at Nabble.com. ```
 Re: [Geotools-gt2-users] How To move a point of X meters. From: Andrea Aime - 2011-04-27 07:55:22 ```On Wed, Apr 27, 2011 at 9:20 AM, elephant2001 wrote: > Thanks a lot. So Is the parameter "distance" of the method setDirection > expressed in meters? > > In the Javadoc isn't written... Yep, meters. I've updated the javadocs Cheers Andrea -- ------------------------------------------------------- Ing. Andrea Aime GeoSolutions S.A.S. Tech lead Via Poggio alle Viti 1187 55054  Massarosa (LU) Italy phone: +39 0584 962313 fax:      +39 0584 962313 http://www.geo-solutions.it http://geo-solutions.blogspot.com/ http://www.youtube.com/user/GeoSolutionsIT http://www.linkedin.com/in/andreaaime http://twitter.com/geowolf ------------------------------------------------------- ```
 Re: [Geotools-gt2-users] How To move a point of X meters. From: Jody Garnett - 2011-04-27 08:55:15 Attachments: Message as HTML ```I am writing this up for the user guide based on andrea's example; the javadoc says the units match the ellipsoid; but all the code examples I can find return meters. I also did somethings I should of done a while ago :-) - JTS.toDirectPosition( Coordinate c, CoordinateReferenceSystem crs ) // an actual wrapper with no new storage used -- Jody Garnett On Wednesday, 27 April 2011 at 5:20 PM, elephant2001 wrote: > Thanks a lot. So Is the parameter "distance" of the method setDirection > expressed in meters? > > In the Javadoc isn't written... > > > -- > View this message in context: http://osgeo-org.1803224.n2.nabble.com/How-To-move-a-point-of-X-meters-tp6305838p6308337.html > Sent from the geotools-gt2-users mailing list archive at Nabble.com. > > ------------------------------------------------------------------------------ > WhatsUp Gold - Download Free Network Management Software > The most intuitive, comprehensive, and cost-effective network > management toolset available today. Delivers lowest initial > acquisition cost and overall TCO of any competing solution. > http://p.sf.net/sfu/whatsupgold-sd > _______________________________________________ > Geotools-gt2-users mailing list > Geotools-gt2-users@... > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users > ```