[Geotools-gt2-users] Build problem with MosaicImageBuilder
Hello, I looking forward to build the java tool MosaicIndexBuilder to use the GeoServer module IndexMosaic. I'm not sure if I'm to stupid to take the right way to build it or whatever. This steps I gone to realise the build. 1.) I have installed the maven, eclipse and have got a check out of the Revision 28743: /geotools/trunk/ and /geotools/trunk/spike/coveragetools with svn. 2.) After that, I have got all important jar's from the m2/repository/ with maven which are referenced from the classpath in the coveragetools. 3.) Than I imported the MosaicIndexBuilder Project into my eclipse, an now the troubles have started. I get only one error in the Build - The Project was not build since its build path is incomplete. Cannot find the class file for org.geotool.factory.Hints. 4.) I have search for the class factory and founnd it in the gt2-main-2.4-SNAPSHOT.jar. Knows anyone a bit of the error or has anyone a piece of solution to solve this error. Thanks for every answer, or tip how I can do it correct. Greets -- View this message in context: http://www.nabble.com/Build-problem-with-MosaicImageBuilder-tp14798522p14798522.html Sent from the geotools-gt2-users mailing list archive at Nabble.com. - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
Re: [Geotools-gt2-users] Build problem with MosaicImageBuilder
Ciao, you have checked out the code at the wrong path. The current svn version of the coveragetools should be located under /gt/modules/unsupported/coveragetools. I provided to remove the old directory under spike which was capturing a really old version of the code. You should be able to check out and build the code from the above location without problems. If this does not applies to you, please, let us know. Regards, Simone. On Jan 14, 2008 11:19 AM, 2StepForward [EMAIL PROTECTED] wrote: Hello, I looking forward to build the java tool MosaicIndexBuilder to use the GeoServer module IndexMosaic. I'm not sure if I'm to stupid to take the right way to build it or whatever. This steps I gone to realise the build. 1.) I have installed the maven, eclipse and have got a check out of the Revision 28743: /geotools/trunk/ and /geotools/trunk/spike/coveragetools with svn. 2.) After that, I have got all important jar's from the m2/repository/ with maven which are referenced from the classpath in the coveragetools. 3.) Than I imported the MosaicIndexBuilder Project into my eclipse, an now the troubles have started. I get only one error in the Build - The Project was not build since its build path is incomplete. Cannot find the class file for org.geotool.factory.Hints. 4.) I have search for the class factory and founnd it in the gt2-main-2.4-SNAPSHOT.jar. Knows anyone a bit of the error or has anyone a piece of solution to solve this error. Thanks for every answer, or tip how I can do it correct. Greets -- View this message in context: http://www.nabble.com/Build-problem-with-MosaicImageBuilder-tp14798522p14798522.html Sent from the geotools-gt2-users mailing list archive at Nabble.com. - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users -- --- Eng. Simone Giannecchini President /CEO GeoSolutions S.A.S. Via Carignoni 51 55041 Camaiore (LU) Italy phone: +39 0584983027 fax: +39 0584983027 mob:+39 333 8128928 http://www.geo-solutions.it --- - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
Re: [Geotools-gt2-users] Build problem with MosaicImageBuilder
Hi Simone, thank's for your answer. I have try to use the coveragetools from the /trunk/gt/modules/unsupported/coveragetools directory, but there is no classpath and project file. I'm not sure, if it's possible for me to use it as project in eclipse without these tow files. Sorry, but I'm not so spezialised confirmed with geotools, but maybe it look's not realy easy to build as project without the classpath and project file. Oh, your revision increasing had make the following Link to a blank at Link: http://docs.codehaus.org/display/GEOSDOC/Using+the+ImageMosaic+plugin codehouse side. Thank's and Greetings Simone.Giannecchini wrote: Ciao, you have checked out the code at the wrong path. The current svn version of the coveragetools should be located under /gt/modules/unsupported/coveragetools. I provided to remove the old directory under spike which was capturing a really old version of the code. You should be able to check out and build the code from the above location without problems. If this does not applies to you, please, let us know. Regards, Simone. On Jan 14, 2008 11:19 AM, 2StepForward [EMAIL PROTECTED] wrote: Hello, I looking forward to build the java tool MosaicIndexBuilder to use the GeoServer module IndexMosaic. I'm not sure if I'm to stupid to take the right way to build it or whatever. This steps I gone to realise the build. 1.) I have installed the maven, eclipse and have got a check out of the Revision 28743: /geotools/trunk/ and /geotools/trunk/spike/coveragetools with svn. 2.) After that, I have got all important jar's from the m2/repository/ with maven which are referenced from the classpath in the coveragetools. 3.) Than I imported the MosaicIndexBuilder Project into my eclipse, an now the troubles have started. I get only one error in the Build - The Project was not build since its build path is incomplete. Cannot find the class file for org.geotool.factory.Hints. 4.) I have search for the class factory and founnd it in the gt2-main-2.4-SNAPSHOT.jar. Knows anyone a bit of the error or has anyone a piece of solution to solve this error. Thanks for every answer, or tip how I can do it correct. Greets -- View this message in context: http://www.nabble.com/Build-problem-with-MosaicImageBuilder-tp14798522p14798522.html Sent from the geotools-gt2-users mailing list archive at Nabble.com. - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users -- --- Eng. Simone Giannecchini President /CEO GeoSolutions S.A.S. Via Carignoni 51 55041 Camaiore (LU) Italy phone: +39 0584983027 fax: +39 0584983027 mob:+39 333 8128928 http://www.geo-solutions.it --- - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users -- View this message in context: http://www.nabble.com/Build-problem-with-MosaicImageBuilder-tp14798522p14800938.html Sent from the geotools-gt2-users mailing list archive at Nabble.com. - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
Re: [Geotools-gt2-users] Build problem with MosaicImageBuilder
Hello, To get a classpath and project file, you can use the command mvn eclipse:eclipse. As an instance, if you need to set up an eclipse project for the unsupported module coveragetools, you can enter (using command line) the gt-trunk/gt/modules/unsupported/coveragetools folder and run mvn eclipse:eclipse there. It will create a proper classpath and project files. Finally, you can import the project from eclipse. Regards, Daniele PS: I will update the links of the cited document. On Jan 14, 2008 1:57 PM, 2StepForward [EMAIL PROTECTED] wrote: Hi Simone, thank's for your answer. I have try to use the coveragetools from the /trunk/gt/modules/unsupported/coveragetools directory, but there is no classpath and project file. I'm not sure, if it's possible for me to use it as project in eclipse without these tow files. Sorry, but I'm not so spezialised confirmed with geotools, but maybe it look's not realy easy to build as project without the classpath and project file. Oh, your revision increasing had make the following Link to a blank at Link: http://docs.codehaus.org/display/GEOSDOC/Using+the+ImageMosaic+plugin codehouse side. Thank's and Greetings Simone.Giannecchini wrote: Ciao, you have checked out the code at the wrong path. The current svn version of the coveragetools should be located under /gt/modules/unsupported/coveragetools. I provided to remove the old directory under spike which was capturing a really old version of the code. You should be able to check out and build the code from the above location without problems. If this does not applies to you, please, let us know. Regards, Simone. On Jan 14, 2008 11:19 AM, 2StepForward [EMAIL PROTECTED] wrote: Hello, I looking forward to build the java tool MosaicIndexBuilder to use the GeoServer module IndexMosaic. I'm not sure if I'm to stupid to take the right way to build it or whatever. This steps I gone to realise the build. 1.) I have installed the maven, eclipse and have got a check out of the Revision 28743: /geotools/trunk/ and /geotools/trunk/spike/coveragetools with svn. 2.) After that, I have got all important jar's from the m2/repository/ with maven which are referenced from the classpath in the coveragetools. 3.) Than I imported the MosaicIndexBuilder Project into my eclipse, an now the troubles have started. I get only one error in the Build - The Project was not build since its build path is incomplete. Cannot find the class file for org.geotool.factory.Hints. 4.) I have search for the class factory and founnd it in the gt2-main-2.4-SNAPSHOT.jar. Knows anyone a bit of the error or has anyone a piece of solution to solve this error. Thanks for every answer, or tip how I can do it correct. Greets -- View this message in context: http://www.nabble.com/Build-problem-with-MosaicImageBuilder-tp14798522p14798522.html Sent from the geotools-gt2-users mailing list archive at Nabble.com. - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users -- --- Eng. Simone Giannecchini President /CEO GeoSolutions S.A.S. Via Carignoni 51 55041 Camaiore (LU) Italy phone: +39 0584983027 fax: +39 0584983027 mob:+39 333 8128928 http://www.geo-solutions.it --- - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users -- View this message in context: http://www.nabble.com/Build-problem-with-MosaicImageBuilder-tp14798522p14800938.html Sent from the geotools-gt2-users mailing list archive at Nabble.com. - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net
Re: [Geotools-gt2-users] Build problem with MosaicImageBuilder
Hi Daniele, yes I have to move it, move it. :-) It works as well. Realy greate thanks to all which support these form. Great Job Greetings and Thanks, 2StepForward Daniele Romagnoli wrote: Hello, To get a classpath and project file, you can use the command mvn eclipse:eclipse. As an instance, if you need to set up an eclipse project for the unsupported module coveragetools, you can enter (using command line) the gt-trunk/gt/modules/unsupported/coveragetools folder and run mvn eclipse:eclipse there. It will create a proper classpath and project files. Finally, you can import the project from eclipse. Regards, Daniele PS: I will update the links of the cited document. On Jan 14, 2008 1:57 PM, 2StepForward [EMAIL PROTECTED] wrote: Hi Simone, thank's for your answer. I have try to use the coveragetools from the /trunk/gt/modules/unsupported/coveragetools directory, but there is no classpath and project file. I'm not sure, if it's possible for me to use it as project in eclipse without these tow files. Sorry, but I'm not so spezialised confirmed with geotools, but maybe it look's not realy easy to build as project without the classpath and project file. Oh, your revision increasing had make the following Link to a blank at Link: http://docs.codehaus.org/display/GEOSDOC/Using+the+ImageMosaic+plugin codehouse side. Thank's and Greetings Simone.Giannecchini wrote: Ciao, you have checked out the code at the wrong path. The current svn version of the coveragetools should be located under /gt/modules/unsupported/coveragetools. I provided to remove the old directory under spike which was capturing a really old version of the code. You should be able to check out and build the code from the above location without problems. If this does not applies to you, please, let us know. Regards, Simone. On Jan 14, 2008 11:19 AM, 2StepForward [EMAIL PROTECTED] wrote: Hello, I looking forward to build the java tool MosaicIndexBuilder to use the GeoServer module IndexMosaic. I'm not sure if I'm to stupid to take the right way to build it or whatever. This steps I gone to realise the build. 1.) I have installed the maven, eclipse and have got a check out of the Revision 28743: /geotools/trunk/ and /geotools/trunk/spike/coveragetools with svn. 2.) After that, I have got all important jar's from the m2/repository/ with maven which are referenced from the classpath in the coveragetools. 3.) Than I imported the MosaicIndexBuilder Project into my eclipse, an now the troubles have started. I get only one error in the Build - The Project was not build since its build path is incomplete. Cannot find the class file for org.geotool.factory.Hints. 4.) I have search for the class factory and founnd it in the gt2-main-2.4-SNAPSHOT.jar. Knows anyone a bit of the error or has anyone a piece of solution to solve this error. Thanks for every answer, or tip how I can do it correct. Greets -- View this message in context: http://www.nabble.com/Build-problem-with-MosaicImageBuilder-tp14798522p14798522.html Sent from the geotools-gt2-users mailing list archive at Nabble.com. - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users -- --- Eng. Simone Giannecchini President /CEO GeoSolutions S.A.S. Via Carignoni 51 55041 Camaiore (LU) Italy phone: +39 0584983027 fax: +39 0584983027 mob:+39 333 8128928 http://www.geo-solutions.it --- - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users -- View this message in context: http://www.nabble.com/Build-problem-with-MosaicImageBuilder-tp14798522p14800938.html Sent from the geotools-gt2-users mailing list archive at Nabble.com. - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source.
[Geotools-gt2-users] CoordSys clause parsing support in MIF plugin
Hi List, Related to this issue : Read and write coordinate system information in MIF format, http://jira.codehaus.org/browse/GEOT-616 I work on a MIFProjReader class using mapinfow.prj in order to write coordsys clause in MIF file. This class generate a static HashMap providing mapping between EPSG code and MapInfo projection system when equivalent exists. I worked on 2.3.4 version of geotools. Is that of any interest for anyone ? Feel free to contact me for more details on it. Regards, Mathieu - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace___ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
Re: [Geotools-gt2-users] Build problem with MosaicImageBuilder
Hello, if one additional question. Now I try to execute the java tool in the directory where the builded MosaicIndexBuilder.class was stored. I execute from the windows cmd-line with: java -cp . MosaicIndexBuilder - without any cmd-line option. The current result is: Exception in thread main java.lang.NoClassDefFoundError: MosaicIndexBuilder (wrong name: it/geosolutions/utils/imagemosaic/MosaicIndexBuilder) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$100(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) I don't know anything about these error, or how i can handle it. Have anyone a plan what is it to do, or wrong. Thanks, 2StepForward -- View this message in context: http://www.nabble.com/Build-problem-with-MosaicImageBuilder-tp14798522p14802695.html Sent from the geotools-gt2-users mailing list archive at Nabble.com. - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
Re: [Geotools-gt2-users] [Geotools-devel] CoordSys clause parsing support in MIF plugin
Hi Mathieu Mathieu Coudert a écrit : Related to this issue : Read and write coordinate system information in MIF format, http://jira.codehaus.org/browse/GEOT-616 I work on a MIFProjReader class using mapinfow.prj in order to write coordsys clause in MIF file. This class generate a static HashMap providing mapping between EPSG code and MapInfo projection system when equivalent exists. I worked on 2.3.4 version of geotools. Is that of any interest for anyone ? Feel free to contact me for more details on it. It would be nice if you could provide your class as an attachment to GEOT-616. I don't know who is the MIF module maintainer, and if this module is maintained at this time. But even if it is not right, it may be later, or we may provide this support at the referencing module level. Martin - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
Re: [Geotools-gt2-users] [Geotools-devel] CoordSys clause parsing support in MIF plugin
done! Mathieu On Jan 14, 2008 4:01 PM, Martin Desruisseaux [EMAIL PROTECTED] wrote: Hi Mathieu Mathieu Coudert a écrit : Related to this issue : Read and write coordinate system information in MIF format, http://jira.codehaus.org/browse/GEOT-616 I work on a MIFProjReader class using mapinfow.prj in order to write coordsys clause in MIF file. This class generate a static HashMap providing mapping between EPSG code and MapInfo projection system when equivalent exists. I worked on 2.3.4 version of geotools. Is that of any interest for anyone ? Feel free to contact me for more details on it. It would be nice if you could provide your class as an attachment to GEOT-616. I don't know who is the MIF module maintainer, and if this module is maintained at this time. But even if it is not right, it may be later, or we may provide this support at the referencing module level. Martin -- Mathieu Coudert [EMAIL PROTECTED] - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace___ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
Re: [Geotools-gt2-users] [Geotools-devel] CoordSys clause parsing support in MIF plugin
Martin Desruisseaux ha scritto: Hi Mathieu ... It would be nice if you could provide your class as an attachment to GEOT-616. I don't know who is the MIF module maintainer, and if this module is maintained at this time. But even if it is not right, it may be later, or we may provide this support at the referencing module level. The MIF module has been unmaintained for years as far as I know. Mathieu, interested in picking it up as a maintainer, improve, bugfix and whatnot? Feel the thrill of being an open source hacker? :) Cheers Andrea - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
Re: [Geotools-gt2-users] Splitting LineStrings at their intersection
After displaying the itineraries on a map (Google maps), I noticed that Dijkstra returned strange results sometimes. It would not take a shorter path for no apparent reason. Hence, I decided to have a look at the splitting function again to see if I could find a problem. I did find one, a test was bad near the end of the function. I fixed it and now the graph is lighter (5 MB instead of 10 MB when serialized). However, dijstra can't seem to find itineraries anymore (just returns null). I'm pretty sure that my patch is Ok, hence the problem must be somewhere else in the function but I can find where. Regards, Chris. On Jan 12, 2008 1:42 AM, Chris [EMAIL PROTECTED] wrote: Hi, I managed to optimize the code so that the work is done in approximately 2 minutes now. This is a great progress. Other good news is that now Dijkstra does not return null anymore, which means that my graph is well connected. Could you look if there is any way to do it faster? 2 minutes is still pretty long and I think I'll have to find a way to save the resulting graph to a file and reload it when needed if it can't be done faster. Anyway, you were right, the Spatial index does allow to gain a lot of time. Thanks a lot. Regards, Chris. On Jan 12, 2008 12:32 AM, Chris [EMAIL PROTECTED] wrote: First of all, thanks a lot for your help. I improved my function using a spatial index (Quadtree). My function seems to be working but I would greatly appreciate if you could have a look and see if I'm doing it right and if it is still possible to optimize it. It has been running for 10 minutes already and it is only the second loop iteration, I get this output: Added 2146 new lines Added 9532 new lines Apparently, there are only 2146 LineStrings in my shapefile, this does not look like much (Is it?). I will let the program run a little to see how it goes. Best regards, Chris. On Jan 11, 2008 11:12 PM, Justin Deoliveira [EMAIL PROTECTED] wrote: Chris wrote: I added some debug, and apparently, the LineString intersection is not due to my algorithm. It happens approximately 12 times in the first loop iteration, then it does not happen anymore. This was probably due to my shapefile. So I chose to ignore the LineString intersections and now my algorithm has been running for approximately half an hour and it is the fourth iteration of the while loop (still unfinished). I added some debug to see how many LineStrings were created for each iteration: Added 2200 new lines Added 7666 new lines Added 26234 new lines Is my algorithm ok? Is it normal it is taking so long? Is there any way I can optimize this? If not, I guess I need to save the result somewhere in a file and work from the result from now on because it is taking too much time. Intersection is quite an expensive operation. I am not surprised it is taking this long with any non-trivial amount of data. Luckily there are some easy ways to optimize this. The best way to be to use a spatial index instead of looping through every line string and doing an intersection. So the the first step of your algorithm will be to populate the index with all of your lines. Its pretty easy to use: SpatialIndex index = ...; for ( LineString l : lines ) { index.insert( l.getEnvelopInternal(), l ); } Then you can replace the second loop with a lookup in the index. //current line being processed LineString l = ...; //do a looup in the index List close = index.query( l.getEnvelopeInternal() ); //do intersection on close lines for ( LineString c : close ) { l.intersect( c ); } .. etc.. This will greatly reduce the number of intersections you have to do and you should see a pretty drastic performance improvement. There are two implementations of com.vividsolutions.jts.index.SpatialIndex: STRTree and QuadTree. The STRTree will give you best performance but it is static, which means you cant update over the stage of your algorithm which you will probably want to do with the new lines that are produced. So you will probably have to just use a the QuadTree implementation. Either one should suffice in this case. Try that and let me know how it works. -Justin Regards, Chris. On Jan 11, 2008 9:28 PM, Chris [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: I tried to use another Vector as you advised. This way, the size the the lines Vector is not changing while iterating on it. I'm joining the new code to this mail. It is taking quite some time (2-3 minutes) but this time I got an exception: java.lang.ClassCastException: com.vividsolutions.jts.geom.LineString cannot be cast to com.vividsolutions.jts.geom.Point at this
Re: [Geotools-gt2-users] Splitting LineStrings at their intersection
I simplified my function. That is to say, when I detect an intersection between l1 and l2, I only split l2. I think that anyway, at some point, the function will detect an intersection between l2 and l1, splitting l1. My LineString vector size is now 2.2M, when serialized. The problem is that Dijkstra is still unable to find a path from a node to another. I think that something must be wrong with my method. or maybe my graph creation? My graph creation is pretty simple though: // Load the shapefile and make a graph file = new File(shapefile); try { URL shapeURL = file.toURL(); ShapefileDataStore dataStore = new ShapefileDataStore(shapeURL); String[] typeNames = dataStore.getTypeNames(); String typeName = typeNames[0]; FeatureSource fs = dataStore.getFeatureSource(typeName); FeatureResults fr = fs.getFeatures(); FeatureCollection fc = fr.collection(); Iterator featureIterator = fc.iterator(); while (featureIterator.hasNext()) { Feature feature = (Feature) featureIterator.next(); MultiLineString multiLineString = (MultiLineString) feature.getDefaultGeometry(); for (int i = 0; i multiLineString.getNumGeometries(); i++) { lines.add((LineString) multiLineString.getGeometryN (i)); } } // Split lines at intersections lines = splitLines(lines); } catch (Exception ex) { ex.printStackTrace(); return null; } //create a linear graph generate DirectedLineStringGraphGenerator lineStringGen = new DirectedLineStringGraphGenerator(); for (int i = 0; i lines.size(); ++i) { lineStringGen.add((LineString) lines.get(i)); } return (DirectedGraph) lineStringGen.getGraph(); I really need to get this project working. I'm making a lot of tests but at the moment, the only time dijkstra did not return null was when using splitlines4.txt (which was buggy IMO). I hope you can have a look at it and point me in the right direction. Thanks in advance. Regards, Chris. On Jan 12, 2008 1:42 AM, Chris [EMAIL PROTECTED] wrote: Hi, I managed to optimize the code so that the work is done in approximately 2 minutes now. This is a great progress. Other good news is that now Dijkstra does not return null anymore, which means that my graph is well connected. Could you look if there is any way to do it faster? 2 minutes is still pretty long and I think I'll have to find a way to save the resulting graph to a file and reload it when needed if it can't be done faster. Anyway, you were right, the Spatial index does allow to gain a lot of time. Thanks a lot. Regards, Chris. On Jan 12, 2008 12:32 AM, Chris [EMAIL PROTECTED] wrote: First of all, thanks a lot for your help. I improved my function using a spatial index (Quadtree). My function seems to be working but I would greatly appreciate if you could have a look and see if I'm doing it right and if it is still possible to optimize it. It has been running for 10 minutes already and it is only the second loop iteration, I get this output: Added 2146 new lines Added 9532 new lines Apparently, there are only 2146 LineStrings in my shapefile, this does not look like much (Is it?). I will let the program run a little to see how it goes. Best regards, Chris. On Jan 11, 2008 11:12 PM, Justin Deoliveira [EMAIL PROTECTED] wrote: Chris wrote: I added some debug, and apparently, the LineString intersection is not due to my algorithm. It happens approximately 12 times in the first loop iteration, then it does not happen anymore. This was probably due to my shapefile. So I chose to ignore the LineString intersections and now my algorithm has been running for approximately half an hour and it is the fourth iteration of the while loop (still unfinished). I added some debug to see how many LineStrings were created for each iteration: Added 2200 new lines Added 7666 new lines Added 26234 new lines Is my algorithm ok? Is it normal it is taking so long? Is there any way I can optimize this? If not, I guess I need to save the result somewhere in a file and work from the result from now on because it is taking too much time. Intersection is quite an expensive operation. I am not surprised it is taking this long with any non-trivial amount of data. Luckily there are some easy ways to optimize this. The best way to be to use a spatial index instead of looping through every line string and doing an intersection. So the the first step of your algorithm will be to populate the index with all of
Re: [Geotools-gt2-users] Splitting LineStrings at their intersection
Trying to see what's wrong with my graph, I decided to print some information. The node I chose to start from is supposed to have 3 edges (which is true, so far so good). However, I displayed the coordinates of the nodes: Origine node: x: 6.844562915500704, y: 47.641801629239914 Nodes of the three connected edges: 6.84316081570757,47.645540708210135 6.844562915500704,47.641801629239914 ___ 6.844562915500704,47.641801629239914 6.844562915500704,47.641801629239914 ___ 6.844562915500704,47.641801629239914 6.844562915500704,47.641801629239914 Two of the edges have the same NodeA and NodeB (which is the origin node)... One of the edges looks good though. Regards, Chris. On Jan 14, 2008 11:38 PM, Chris [EMAIL PROTECTED] wrote: I simplified my function. That is to say, when I detect an intersection between l1 and l2, I only split l2. I think that anyway, at some point, the function will detect an intersection between l2 and l1, splitting l1. My LineString vector size is now 2.2M, when serialized. The problem is that Dijkstra is still unable to find a path from a node to another. I think that something must be wrong with my method. or maybe my graph creation? My graph creation is pretty simple though: // Load the shapefile and make a graph file = new File(shapefile); try { URL shapeURL = file.toURL(); ShapefileDataStore dataStore = new ShapefileDataStore(shapeURL); String[] typeNames = dataStore.getTypeNames(); String typeName = typeNames[0]; FeatureSource fs = dataStore.getFeatureSource(typeName); FeatureResults fr = fs.getFeatures(); FeatureCollection fc = fr.collection(); Iterator featureIterator = fc.iterator(); while (featureIterator.hasNext()) { Feature feature = (Feature) featureIterator.next(); MultiLineString multiLineString = (MultiLineString) feature.getDefaultGeometry(); for (int i = 0; i multiLineString.getNumGeometries(); i++) { lines.add((LineString) multiLineString.getGeometryN(i)); } } // Split lines at intersections lines = splitLines(lines); } catch (Exception ex) { ex.printStackTrace(); return null; } //create a linear graph generate DirectedLineStringGraphGenerator lineStringGen = new DirectedLineStringGraphGenerator(); for (int i = 0; i lines.size(); ++i) { lineStringGen.add((LineString) lines.get(i)); } return (DirectedGraph) lineStringGen.getGraph(); I really need to get this project working. I'm making a lot of tests but at the moment, the only time dijkstra did not return null was when using splitlines4.txt (which was buggy IMO). I hope you can have a look at it and point me in the right direction. Thanks in advance. Regards, Chris. On Jan 12, 2008 1:42 AM, Chris [EMAIL PROTECTED] wrote: Hi, I managed to optimize the code so that the work is done in approximately 2 minutes now. This is a great progress. Other good news is that now Dijkstra does not return null anymore, which means that my graph is well connected. Could you look if there is any way to do it faster? 2 minutes is still pretty long and I think I'll have to find a way to save the resulting graph to a file and reload it when needed if it can't be done faster. Anyway, you were right, the Spatial index does allow to gain a lot of time. Thanks a lot. Regards, Chris. On Jan 12, 2008 12:32 AM, Chris [EMAIL PROTECTED] wrote: First of all, thanks a lot for your help. I improved my function using a spatial index (Quadtree). My function seems to be working but I would greatly appreciate if you could have a look and see if I'm doing it right and if it is still possible to optimize it. It has been running for 10 minutes already and it is only the second loop iteration, I get this output: Added 2146 new lines Added 9532 new lines Apparently, there are only 2146 LineStrings in my shapefile, this does not look like much (Is it?). I will let the program run a little to see how it goes. Best regards, Chris. On Jan 11, 2008 11:12 PM, Justin Deoliveira [EMAIL PROTECTED] wrote: Chris wrote: I added some debug, and apparently, the LineString intersection is not due to my algorithm. It happens approximately 12 times in the first loop iteration, then it does not happen anymore. This was probably due to my shapefile. So I chose to ignore the LineString intersections and now my algorithm has been running for approximately half an hour and it is the fourth iteration of the
Re: [Geotools-gt2-users] Splitting LineStrings at their intersection
Could you tell me what is wrong with this part of code? Coordinate[] c = new Coordinate[]{(l1.getStartPoint()).getCoordinate(), p.getCoordinate()}; LineString l1a = new LineString(new CoordinateArraySequence(c), new GeometryFactory()); l1_sub.add(l1a); if(!l1.covers(l1a)) System.out.println(Error: a); It displays Error: a. Because of this, it happens that none of the subparts of l1 intersects with l2 :( Regards, Chris. On Jan 15, 2008 1:09 AM, Chris [EMAIL PROTECTED] wrote: Trying to see what's wrong with my graph, I decided to print some information. The node I chose to start from is supposed to have 3 edges (which is true, so far so good). However, I displayed the coordinates of the nodes: Origine node: x: 6.844562915500704, y: 47.641801629239914 Nodes of the three connected edges: 6.84316081570757,47.645540708210135 6.844562915500704,47.641801629239914 ___ 6.844562915500704,47.641801629239914 6.844562915500704,47.641801629239914 ___ 6.844562915500704,47.641801629239914 6.844562915500704,47.641801629239914 Two of the edges have the same NodeA and NodeB (which is the origin node)... One of the edges looks good though. Regards, Chris. On Jan 14, 2008 11:38 PM, Chris [EMAIL PROTECTED] wrote: I simplified my function. That is to say, when I detect an intersection between l1 and l2, I only split l2. I think that anyway, at some point, the function will detect an intersection between l2 and l1, splitting l1. My LineString vector size is now 2.2M, when serialized. The problem is that Dijkstra is still unable to find a path from a node to another. I think that something must be wrong with my method. or maybe my graph creation? My graph creation is pretty simple though: // Load the shapefile and make a graph file = new File(shapefile); try { URL shapeURL = file.toURL(); ShapefileDataStore dataStore = new ShapefileDataStore(shapeURL); String[] typeNames = dataStore.getTypeNames(); String typeName = typeNames[0]; FeatureSource fs = dataStore.getFeatureSource(typeName); FeatureResults fr = fs.getFeatures(); FeatureCollection fc = fr.collection(); Iterator featureIterator = fc.iterator(); while (featureIterator.hasNext()) { Feature feature = (Feature) featureIterator.next(); MultiLineString multiLineString = (MultiLineString) feature.getDefaultGeometry(); for (int i = 0; i multiLineString.getNumGeometries(); i++) { lines.add((LineString) multiLineString.getGeometryN(i)); } } // Split lines at intersections lines = splitLines(lines); } catch (Exception ex) { ex.printStackTrace(); return null; } //create a linear graph generate DirectedLineStringGraphGenerator lineStringGen = new DirectedLineStringGraphGenerator(); for (int i = 0; i lines.size(); ++i) { lineStringGen.add((LineString) lines.get(i)); } return (DirectedGraph) lineStringGen.getGraph(); I really need to get this project working. I'm making a lot of tests but at the moment, the only time dijkstra did not return null was when using splitlines4.txt (which was buggy IMO). I hope you can have a look at it and point me in the right direction. Thanks in advance. Regards, Chris. On Jan 12, 2008 1:42 AM, Chris [EMAIL PROTECTED] wrote: Hi, I managed to optimize the code so that the work is done in approximately 2 minutes now. This is a great progress. Other good news is that now Dijkstra does not return null anymore, which means that my graph is well connected. Could you look if there is any way to do it faster? 2 minutes is still pretty long and I think I'll have to find a way to save the resulting graph to a file and reload it when needed if it can't be done faster. Anyway, you were right, the Spatial index does allow to gain a lot of time. Thanks a lot. Regards, Chris. On Jan 12, 2008 12:32 AM, Chris [EMAIL PROTECTED] wrote: First of all, thanks a lot for your help. I improved my function using a spatial index (Quadtree). My function seems to be working but I would greatly appreciate if you could have a look and see if I'm doing it right and if it is still possible to optimize it. It has been running for 10 minutes already and it is only the second loop iteration, I get this output: Added 2146 new lines Added 9532 new lines Apparently, there are only 2146 LineStrings in my shapefile, this does not look like much (Is it?). I will let the program run a
[Geotools-gt2-users] Saving FeatureSource to shapefile
Hello, I am wondering if there is a simple way of saving a FeatureSource to a shapefile. The FeatureSource is backed by an MStore. I can't quite see how to do this. I've gotten as far as this: FeatureSource fs = mapLayer.getFeatureSource(); //pre-existing featursource FileDataStoreFactorySpi factory = new IndexedShapefileDataStoreFactory(); Map map = Collections.singletonMap( url, file.toURL()); //file from chooser DataStore myData = factory.createNewDataStore( map ); myData.createSchema(fs.getSchema()); Thanx gaby -- http://www.chimere.org/ http://walbatross.blogspot.com ** Throw the radio up high / Watch us drown out half the sky ** ** Synaesthesia coloured blue / Aquaman knows what to do** - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users