Hello Pete,

> I think you are referring to the "extractPoint" function. But the function
> selects the Point between in a fraction between [0,1]

No, it takes a distance in whatever units you are using for your
geometries.  For example, assuming a Cartesian space (and without
checking line direction here)...

double interval = 50d;
double distance = interval;
double end = myLine.getEndPoint().x;
LengthIndexedLine lil = new LengthIndexedLine(myLine);
List<Coordinate> points = new ArrayList<Coordinate>();
while (true) {
    p = lil.extractPoint(distance);
    if (p.x > end) break;
    points.add(p);
    distance += interval;
}

> and i like to have
> something like "find the lat/lon position with the distance of 50meter from
> the beginning"

JTS doesn't know about non-Cartesian geometries like lat-long.  You
can use lat-long coords and if the distances involved are very small
it will be ok, but as they get larger the calculations will become
more inaccurate.

> I belive i have to convert my wgs84-linestring to use the extractPoint
> function the way i want it... but i don't really know how...

You are probably best re-projecting your coords into a system that is
relevant to the area that you are dealing with for accuracy.  Select a
projection (e.g. UTM Zone 55S for me here in Sydney) and find it's
EPSG code (http://www.epsg-registry.org/).

Then one way to reproject your geometry (someone else here will surely
point out a more elegant way !)

// not showing exception handling here...
CoordinateReferenceSystem inCRS = DefaultGeographicCRS.WGS84;  // you
are using this ?
CoordinateReferenceSystem outCRS = CRS.decode( someEPSGCode );
MathTransform in2out = CRS.findMathTransform(inCRS, outCRS);
MathTransform out2in = in2out.inverse();

LineString trLine = JTS.transform( latLongLine, in2out );

Hope this helps

Michael

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to