Quantcast

Constructing a specific offset point or line.&In-Reply-To=ae7cd1ca0808071028v6241d7ffjf1

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Constructing a specific offset point or line.&In-Reply-To=ae7cd1ca0808071028v6241d7ffjf1

jericks
I too am interesting in constructing an offset point from a line on both the left and right side, but I can't seem to the find the LengthIndexedLine.extractPoint(index, offset) method.  I looked at the JTS 1.9 JavaDocs and source code.  Am I missing something or looking in the wrong place?
 
Thanks,
Jared

_______________________________________________
jts-devel mailing list
[hidden email]
http://lists.refractions.net/mailman/listinfo/jts-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Constructing a specific offset point or line.&In-Reply-To=ae7cd1ca0808071028v6241d7ffjf1

michaelm-2
Hi,

I also needed LengthIndexedLine.extractPoint(index, offset) recently and
had to load and to compile the current cvs version of JTS.
I think it has been recently added into the library.

Michaël


Jared Erickson a écrit :

> I too am interesting in constructing an offset point from a line on both the left and right side, but I can't seem to the find the LengthIndexedLine.extractPoint(index, offset) method.  I looked at the JTS 1.9 JavaDocs and source code.  Am I missing something or looking in the wrong place?
>  
> Thanks,
> Jared
>
> _______________________________________________
> jts-devel mailing list
> [hidden email]
> http://lists.refractions.net/mailman/listinfo/jts-devel
>
>
>  

_______________________________________________
jts-devel mailing list
[hidden email]
http://lists.refractions.net/mailman/listinfo/jts-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Constructing a specific offset point or line.&In-Reply-To=ae7cd1ca0808071028v6241d7ffjf1

Martin Davis
In reply to this post by jericks
The extractPoint with offset method is targetted for JTS 1.10 - it's in
CVS right now, but not in JTS 1.9.

In the meantime the function is pretty easy to implement as an extension
in your own code - the following should work:

  /**
   * Computes the {@link Coordinate} for the point
   * on the line at the given index, offset by the given distance.
   * If the index is out of range the first or last point on the
   * line will be returned.
   * The computed point is offset to the left of the line if the offset
distance is
   * positive, to the right if negative.
   *
   * The Z-ordinate of the computed point will be interpolated from
   * the Z-ordinates of the line segment containing it, if they exist.
   *
   * @param index the index of the desired point
   * @param offsetDistance the distance the point is offset from the segment
   *    (positive is to the left, negative is to the right)
   * @return the Coordinate at the given index
   */
  public static Coordinate extractPoint(Geometry linearGeom, double
index, double offsetDistance)
  {
    LinearLocation loc = LengthLocationMap.getLocation(linearGeom, index);
    return
loc.getSegment(linearGeom).pointAlongOffset(loc.getSegmentFraction(),
offsetDistance);
  }


Jared Erickson wrote:

> I too am interesting in constructing an offset point from a line on both the left and right side, but I can't seem to the find the LengthIndexedLine.extractPoint(index, offset) method.  I looked at the JTS 1.9 JavaDocs and source code.  Am I missing something or looking in the wrong place?
>  
> Thanks,
> Jared
>
> _______________________________________________
> jts-devel mailing list
> [hidden email]
> http://lists.refractions.net/mailman/listinfo/jts-devel
>
>  

--
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022

_______________________________________________
jts-devel mailing list
[hidden email]
http://lists.refractions.net/mailman/listinfo/jts-devel
Loading...