Hi,I think the following link will be helpful
http://spatialreference.org/ref/epsg/32631/On the spatialreference.org site
each UTM zone (epsg code) has a geographical boundary. eg for 32631 the bounds
are as followsWGS84 Bounds: 0.0000, 0.0000, 6.0000, 84.0000
Projected Bounds: 166021.4431, 0.0000, 833978.5569, 9329005.1825I don't know
what your requirements are but if ur application is restricted to a region eg a
country or a no of countries u can do a point in polygon test i.e. compare the
lon/lat point you have with a set bounding boxes (each box corresponding to the
UTM zones your app covers).Roman.
--- On Sun, 8/30/09, Alex <azli...@gmail.com> wrote:
From: Alex <azli...@gmail.com>
Subject: Re: [Geotools-gt2-users] Creating a buffer around a point
To: geotools-gt2-users@lists.sourceforge.net
Date: Sunday, August 30, 2009, 9:40 PM
Thanks Michael.
In fact I think I have been using incorrect EPSG code for RadiusCRS.
I tried with EPSG:32631 and the recult is closer to what I expected. So my best
guess is that I'm using icorrect UTM zone for my point.
I think that I first need to figure out the correct UTM zone for the
latitude/longitude of my point.
The thing is I don't know in advance where my point will be located so I really
can't hardcode the EPSG code for the UTM.
so now comes my second question :)
Is there a way to calculate the UTM zone and the corresponding EPSG code for
given latitude / longitude coordinates.
Thank you for your insights.
Cheers
On Mon, Aug 31, 2009 at 4:37 AM, Michael Bedward <michael.bedw...@gmail.com>
wrote:
Hi Alex,
You've been snared by the "axis order" trap :)
If you edit the CRS.decode calls to this...
CoordinateReferenceSystem pointCRS = CRS.decode("EPSG:4326", true);
CoordinateReferenceSystem radiusCRS = CRS.decode("EPSG:32630", true);
...your buffer will be centred on the point.
Michael
2009/8/30 Alex <azli...@gmail.com>:
> Hi,
>
> I'm having difficulties figuring out how to create a buffer on N meters
> around a given point.
> I work with JTS geometries and I try to use the following code :
>
>
> public static Geometry getPointBuffer(Point point, double distanceMeters)
> throws NoSuchAuthorityCodeException, FactoryException,
> MismatchedDimensionException, TransformException{
>
> CoordinateReferenceSystem pointCRS = CRS.decode("EPSG:4326");
> CoordinateReferenceSystem radiusCRS = CRS.decode("EPSG:32630");
>
>
> MathTransform transformToUtm = CRS.findMathTransform(pointCRS,
> radiusCRS);
>
> Geometry targetGeometry = JTS.transform( point, transformToUtm);
>
> Geometry buffer = targetGeometry.buffer(distanceMeters);
> buffer.setSRID(32630);
>
> MathTransform transformToGeo = CRS.findMathTransform(radiusCRS,
> pointCRS);
>
> Geometry bufferGeo = JTS.transform( buffer, transformToGeo);
> bufferGeo.setSRID(4326);
>
>
> return bufferGeo;
>
> }
>
>
> for the following point :
>
> POINT (2.16229 41.3953)
>
> and a distance of 5000 meters
>
> I get the following polygon :
> POLYGON ((2.1668585664549775 41.35554016723455, 2.1605728155293
> 41.35471376204175, 2.154571657038669 41.35270371296712, 2.1490854073842818
> 41.349587027106196, 2.144324701588059 41.345483128365466, 2.1404724289152757
> 41.34054932112889, 2.13767671399557 41.334974806952445, 2.1360452117294355
> 41.328973474816856, 2.1356409371529472 41.32277573270135, 2.1364797955297057
> 41.316619686596034, 2.138529914925493 41.310742000847185, 2.141712815464533
> 41.30536878944814, 2.1459063787954538 41.3007068904193, 2.150949510736572
> 41.296935864099616, 2.156648322542981 41.294201030919375, 2.1627835947102874
> 41.29260782561655, 2.1691192345488095 41.29221769417829, 2.175411397470465
> 41.293045698993566, 2.1814179140899173 41.29505992935786, 2.1869076522796567
> 41.298182741613445, 2.1916694459194326 41.30229377916705, 2.195520240128788
> 41.30723465081568, 2.198312135359968 41.31281507951014, 2.1999380582252
> 41.31882027583668, 2.2003358431020676 41.32501924352674, 2.1994905727257703
> 41.33117369000711, 2.197435095200101 41.337047194460446, 2.19424870612777
> 41.34241427945901, 2.190054054957272 41.347069039672576, 2.185012401483143
> 41.35083300158266, 2.1793174093663206 41.353561920250755, 2.1731877165978544
> 41.35515126136847, 2.1668585664549775 41.35554016723455))
>
>
> which is not correct at all !
>
> the initial point is not within the bounds of the created buffer ....
>
> The funny thing is this method worked fine in a similar project ... but now
> I can't figure out what's happening.
>
> As you will see the Points I'm dealing with are located in the Barcelona
> area. I don't know if this has an incidence.
>
> What am I doing wrong ?
> How can I properly create a buffer of XXX meters around a given Point
>
>
> Many thanks for helping me :)
>
> Cheers.
>
>
>
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Geotools-gt2-users mailing list
> Geotools-gt2-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>
-----Inline Attachment Follows-----
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
-----Inline Attachment Follows-----
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users