Roberto:

Michael wrote: "For your first question, the short answer is that JTS works with
cartesian (planar) geometry so it won't deal correctly with distances
between points on the globe expressed as lat/long coords.  There are
various ways to do what you want."

One of the techniques Michael was talking about is to project your
lat/long data into a grid coordinate system. Once this conversion is
completed you can use JTS. JTS isn't really made to work with geodetic
coordinates directly, at least not over large areas.

You need to:

[1] Convert your geodetic data to grid/plane data.
[2] Manipulate your grid data in JTS.
[3] Convert back to geodetic data if needed.

You can use GeoTools or the deegree Project libraries to accomplish
your conversions from geodetic to grid. Just make sure you understand
the distortions of the map projection you select.

Roberto wrote: "About my second question, I want to know if I'm doing
the right thing (most efficient): I want to have the "dynamic"
characteristic of Coordinate (i.e., change values) but I also want to
have the funcionality of Point, want to use the geometric operations.
So I think I must use Coordinate in my class and then instantiate a
Point/Geometry with the coordinate's value everytime I need to perform
a calculation. Is that right?"

I think there may be a more efficient way to accomplish what you seek.
Create a CoordinateFilter implementation and call the
apply(CoordinateFilter argFilter) method of the Point class to
complete the translation you desire. I think I have a CoordinateFilter
implementation whipped up that will do this. I can share it if you
like, but it shouldn't be that hard to write.

The Sunburned Surveyor

On Tue, Mar 31, 2009 at 5:15 AM,  <[email protected]> wrote:
> Hello Michael
>
> Thank you for your answer!
> About my second question, I want to know if I'm doing the right thing (most
> efficient): I want to have the "dynamic" characteristic of Coordinate (i.e.,
> change values) but I also want to have the funcionality of Point, want to
> use the geometric operations. So I think I must use Coordinate in my class
> and then instantiate a Point/Geometry with the coordinate's value everytime
> I need to perform a calculation. Is that right?
>
> Roberto
>
>
> On Mar 30, 2009 8:05pm, Michael Bedward <[email protected]> wrote:
>> Hi Roberto,
>>
>>
>>
>> For your first question, the short answer is that JTS works with
>>
>> cartesian (planar) geometry so it won't deal correctly with distances
>>
>> between points on the globe expressed as lat/long coords.  There are
>>
>> various ways to do what you want.  See this recent discussion...
>>
>> http://n2.nabble.com/Lat-lon-coordinate-systems.-td2275815.html
>>
>>
>>
>> For your second question. If you have created a Coordinate object to
>>
>> hold current position, you can always change the x and y values
>>
>> without needing to construct a new object..
>>
>>
>>
>> Coordinate c = new Coordinate();
>>
>> c.x = ...
>>
>> c.y = ...
>>
>>
>>
>> // later
>>
>> c.x = ...
>>
>> c.y = ...
>>
>>
>>
>> But perhaps I don't understand your question correctly.  If not,
>>
>> please say so...
>>
>>
>>
>> Hope this helps
>>
>> Michael
>>
>>
>>
>>
>>
>> 2009/3/31  [email protected]>:
>>
>> > I'm a beginner and have two questions I couldn't find the answer in
>>
>> > documentation:
>>
>> >
>>
>> > - Is it possible to define a projection system for my calculations?
>> > Example,
>>
>> > I want to calculate the distance in km between two points that has
>>
>> > coordinates in latitude/longitude degrees in a given projection system
>> > for
>>
>> > Earth.
>>
>> >
>>
>> > - I made a class that represents a moving object, so I used Coordinate
>>
>> > implement its location (that changes all the time). I wanted to use
>> > Point,
>>
>> > but Coordinate is the best class for dynamic info. So I'm instantiating
>> > a
>>
>> > new Geometry everytime I need to perform calculation using this objects,
>> > is
>>
>> > that right?
>>
>> >
>>
>> > Thank you.
>>
>> > _______________________________________________
>>
>> > jts-devel mailing list
>>
>> > [email protected]
>>
>> > http://lists.refractions.net/mailman/listinfo/jts-devel
>>
>> >
>>
>> >
>>
>> _______________________________________________
>>
>> jts-devel mailing list
>>
>> [email protected]
>>
>> http://lists.refractions.net/mailman/listinfo/jts-devel
>>
> _______________________________________________
> jts-devel mailing list
> [email protected]
> http://lists.refractions.net/mailman/listinfo/jts-devel
>
>
_______________________________________________
jts-devel mailing list
[email protected]
http://lists.refractions.net/mailman/listinfo/jts-devel

Reply via email to