Spliting a LineString

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Spliting a LineString

Chris Baines
I am writing a web app using the Spring framework and Hibernate 3, the
application does routing, and I have code that gives a series of
points representing a route, and a time to cover the total distance. I
would like to be able to work out, for a point on the route, how much
distance has been covered, and how much is remaining (so I can work
out the time remaining). I have tried to construct a MLineString, and
I believe I have done that correctly, but when I do:

coordOnLine = lineString.getClosestPoint (point, 30d);

I get a MGeometryException.OPERATION_REQUIRES_MONOTONE type MGeometryException.

Can anyone help?

Thanks,

Chris
_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Reply | Threaded
Open this post in threaded view
|

Re: Spliting a LineString

Karel Maesen
Administrator
Hi Chris,

The getClosestPoint() - like the other linear referencing functions in the package - require that the measure-values of the coordinate are either
all increasing or all decreasing if you visit the coordinates sequentially. If that is not the case, e.g. because some measures have NaN, then the function
throws that exception and gives up. It seems to me that in your use case, the constraint is also reasonable.

You should verify that you have satisfied this constraint when constructing the MLineString. You could use MLineString.toString() to print out a textual representation showing the M-value for each coordinate.

Regards,

Karel

On 21 Aug 2012, at 12:10, Chris Baines wrote:

> I am writing a web app using the Spring framework and Hibernate 3, the
> application does routing, and I have code that gives a series of
> points representing a route, and a time to cover the total distance. I
> would like to be able to work out, for a point on the route, how much
> distance has been covered, and how much is remaining (so I can work
> out the time remaining). I have tried to construct a MLineString, and
> I believe I have done that correctly, but when I do:
>
> coordOnLine = lineString.getClosestPoint (point, 30d);
>
> I get a MGeometryException.OPERATION_REQUIRES_MONOTONE type MGeometryException.
>
> Can anyone help?
>
> Thanks,
>
> Chris
> _______________________________________________
> hibernatespatial-users mailing list
> [hidden email]
> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users

_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users