Hi Jerry,
Once the graph is built each, edge#getObject() will hold the original
feature used to built it. So something like
for ( Iterator e = graph.getEdges().iterator(); e.hasNext(); ) {
Edge edge = (Edge) e.next();
Feature feature = (Feature) e.getObject();
..
}
Good question Jerry. Any chance you want to help me out by adding this
to the code sample page?
-Justin
Swan Jerry wrote:
>> I have updated that page with a more recent example
> Thanks. Given a graph that has been constructed in this fashion, how
> should I convert it back into a FeatureCollection?
>
> I ask because the 'obvious' solution, i.e. using
> someFeatureCollection.addAll( graphGetNodes() ) and addAll(
> graph.getEdges() ), gives a ClassCastException from BasicNode to
> Feature.
>
> Jerry.
>
> -----Original Message-----
> From: Justin Deoliveira [mailto:[EMAIL PROTECTED]
> Sent: 04 April 2007 19:40
> To: Swan Jerry
> Cc: [email protected]
> Subject: Re: [Geotools-gt2-users] Simple graph question
>
> Hi Jerry,
>
> I have updated that page with a more recent example of how to build a
> graph from features on geotools 2.3.x and above.
>
> Note, i realized that there was a big that has been fixed on trunk,
> which i just back ported to 2.3.x. You can get around it though by using
> lineStringGen.getGraph() instead of featureGen.getGraph().
>
> If you are working from sources though just update and the example
> should be just fine.
>
> Let me know how it works for you.
>
> -Justin
>
> Swan Jerry wrote:
>> Given a FeatureCollection, I'd like to build an (undirected) graph
>> directly corresponding to its feature geometry, i.e. having a node for
>
>> each point.
>>
>> Would someone kindly recommend the simplest graph building strategy
>> for this?
>>
>> In particular, the example at
>> http://docs.codehaus.org/display/GEOTOOLS/Graphs doesn't appear to be
>> current - AFAIK there's no org.geotools.graph.build.LineGraphBuilder
>> in GT2.3.0 (whearas there are of course
>> org.geotools.graph.build.line.BasicLineGraphBuilder etc).
>>
>> Thanks once more,
>>
>> Jerry.
>>
>> This message has been checked for viruses but the contents of an
>> attachment may still contain software viruses, which could damage your
> computer system:
>> you are advised to perform your own checks. Email communications with
>> the University of Nottingham may be monitored as permitted by UK
> legislation.
>>
>> ----------------------------------------------------------------------
>> --- Take Surveys. Earn Cash. Influence the Future of IT Join
>> SourceForge.net's Techsay panel and you'll get the chance to share
>> your opinions on IT & business topics through brief surveys-and earn
>> cash
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEV
>> DEV _______________________________________________
>> Geotools-gt2-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>
> --
> Justin Deoliveira
> The Open Planning Project
> [EMAIL PROTECTED]
>
> This message has been checked for viruses but the contents of an attachment
> may still contain software viruses, which could damage your computer system:
> you are advised to perform your own checks. Email communications with the
> University of Nottingham may be monitored as permitted by UK legislation.
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Geotools-gt2-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
--
Justin Deoliveira
The Open Planning Project
[EMAIL PROTECTED]
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users