I think you will want to look inside the code of both of those; and produce 
your own graph generator that does exactly what you want.
Jody

On 17/06/2010, at 5:27 PM, Oleg Demchenko wrote:

> Hi Jody.
>  
> I'm using DirectedLineStringGraphGenerator to build a Directed Graph from 
> Vector<LineString>.
> ...
>  
>            //create a linear graph generate
>            DirectedLineStringGraphGenerator lineStringGen = new   
> DirectedLineStringGraphGenerator();
>            for (int i = 0; i < lines.size(); ++i) {
>                lineStringGen.add((LineString) lines.get(i));
>            }
>            DirectedGraph g= lineStringGen.getGraph();
> 
> Also there is example from GEOTools documentation which use 
> FeatureGraphGenerator wrapper
> // get a feature collection somehow
> FeatureCollection fCollection = featureSource.getFeatures(Filter.INCLUDE);
> FeatureIterator featureIterator = fCollection.features();
>  
> //create a linear graph generate
> LineStringGraphGenerator lineStringGen = new LineStringGraphGenerator();
> //wrap it in a feature graph generator
> FeatureGraphGenerator featureGen = new FeatureGraphGenerator( lineStringGen );
> //throw all the features into the graph generator
> Iterator iter = fCollection.iterator();
> while(iter.hasNext()){
>      Feature feature = (Feature)iter.next();
>      featureGen.add( feature );
> }
> Graph g = featureGen.getGraph()
> 
> Please, advice what is class name of the builder which may help me to build a 
> well connected graph from a line segments?
>  
>  
> 2010/6/17 Jody Garnett <jody.garn...@gmail.com>
> There is also a seperate builder that builds a graph based on the line 
> segmenets; perhaps you could combine the two ideas in your own graph builder 
> and contribute the result back/
> 
> Jody
> 
> On 16/06/2010, at 8:08 PM, Oleg Demchenko wrote:
> 
>> Hi Dear All.
>>  
>> I'm quite new in Geotools area and hope somebody of you will point me a 
>> proper direction.
>>  
>> I'm developing a server side Java method  which should estimate shortest 
>> vehicle path between any 2 points placed within 1 country.
>>  
>> Data is given from a Denmark OSM highway shapefile downloaded from public 
>> CloudsMade server. In order to optimize process I'm selecting from database 
>> features (lines) placed within a rectangle between start and end points. 
>> Usually it is 1500- 10 000 of LineString objects.
>>  
>> From geotools-gt2-users mail archive I've learnt that lines MUST be 
>> intersected each other otherwise DijkstraShortestPathFinder will not return 
>> any path between given source and destination nodes for a Directed graph 
>> built from a lines array.
>> There is mailing initiated by Cris  
>> (http://www.mail-archive.com/geotools-gt2-users@lists.sourceforge.net/msg04520.html)
>>  regarding splitlines function. I'm using last function version published by 
>> Cris  Jan 2008 (please find it at the end of the mail), but after days of 
>> debug found it over optimized.
>> 
>> Usually it is only double number of lines from input Vector<LineString>. For 
>> 1500 lines it built less then 3000 of intersected lines. As an Impact 
>> DijkstraShortestPathFinder can't find a path for the most source/destination 
>> points distanced more then 40 Kms each other, because Graph is not well 
>> connected.
>>  
>> Could somebody point me, please,  on the source where I could find good 
>> intersection method for Vector<LineString> using Quadtree?
>> 
>> How I can check that Graph is well partitioned and most of nodes are 
>> connected each other?
>>  
>> Thank you in advance for your reply.
> 
> 
> -- 
> All the best
>               Oleg Demchenko

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to