Hmmm... still odd that it is blocking. What is the cpu doing at the
point it blocks? Is it maxed out in an infinite loop? Could you perhaps
send me a subset of the data in your postgis table so i could try it out.
You have a couple of different options for dealing with
MultiLineStrings, depending on how you want to build the graph. The code
you supplied builds a graph which will be noded at every single
coordinate, which is perfectly valid.
An alternative would be to build the graph so that it is noded only at
LineString ends. To do this you could do something like this:
LineStringGraphGenerator graphGen = new LineStringGraphGenerator();
FeatureIterator featureIterator = fc.iterator();
while( featureIterator.hasNext() ) {
Feature feature = (Feature) featureIterator.next();
MultiLineString multiLineString = (MultiLineString)
feature.getDefaultGeometry();
for ( int i = 0; i < multiLineString.getNumGeometies(); i++ ) {
LineString lineString = (LineString) multiLineString.getGeometryN(i);
graphGen.add( lineString );
}
}
-Justin
Jonathan Gillot wrote:
> Hi,
>
> thanks for your answer, yes it blocks on the first call to
> graphGen.add(), in fact, i think that the problem is that my data are
> multiLinesString and more over the first object have three coordinate,
> here is it : MULTILINESTRING (( 247721.97065438988 140054.85414528567,
> 247752.246324072 140065.42999560665, 247799.81835839822
> 140098.57889520936)) this come from a postgis database.
> What is the right way to deal with multiLineStings?
>
> thanks,
>
> Jonathan
>
>
> Hi Jonathan,
>
> I cant see anything wrong with the code. Are any line segments able to
> be added, or does it block on the first call to graphGen.add()?
>
> Also, i have updated the page with an example of how to calculate
> shortest paths in a graph. Its at the end of the page.
>
>
> -Justin
>
>
> !DSPAM:4007,46499a1e303413668746562!
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
>
> !DSPAM:4007,46499a1e303413668746562!
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Geotools-gt2-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>
> !DSPAM:4007,46499a1e303413668746562!
--
Justin Deoliveira
The Open Planning Project
[EMAIL PROTECTED]
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users