Hi Martin,
Yeah you should be able to get at the underlying LineString by calling
e.getObject(). Something like:
DijkstraIterator.EdgeWeigter weighter =new DijkstraIterator.EdgeWeighter()
{
public double getWeight(Edge e) {
LineString l = (LineString) e.getObject();
return l.getLength();
}
}
However the linestring has no notion of units. That will depend on whatever
coordinate system your data is in.
On Wed, Sep 1, 2010 at 10:55 AM, Martin Tomko <[email protected]>wrote:
> Dear All,
> I am using the Graph api to construct a graph based on lineStrings -
> that works perfectly. I would like to do a shortest path computation
> based on geographical distance, and need to implement a Weighter.
>
> the docs show this snippet:
>
> DijkstraIterator.EdgeWeigter weighter =new DijkstraIterator.EdgeWeighter()
> {
> public double getWeight(Edge e) {
> return 1.0;//constant
> }
> }
>
> which results in a constant weight for an edge of 1.
>
> How do I get the actual length of an edge, in the original feature's
> units...
>
> I need the values also for other purposes, so really neend to access the
> edge length property.
> Is it possible?
> Thanks
> Martin
>
>
>
>
> ------------------------------------------------------------------------------
> This SF.net Dev2Dev email is sponsored by:
>
> Show off your parallel programming skills.
> Enter the Intel(R) Threading Challenge 2010.
> http://p.sf.net/sfu/intel-thread-sfd
> _______________________________________________
> Geotools-gt2-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.
------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:
Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users