[JPP-Devel] YOURS routing with OpenJUMP
Hi, Michaël wrote 60 lines of BeanShell code which makes OpenJUMP capable for using external YOURS routing services. I think this is quite interesting and therefore I wrote a short teaser. http://latuviitta.org/documents/YOURS_routing_with_OpenJUMP.pdf -Jukka Rahkonen- -- Own the Future-Intel(R) Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game demo contest. Compete for recognition, cash, and the chance to get your game on Steam. $5K grand prize plus 10 genre and skill prizes. Submit your demo by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2 ___ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
Re: [JPP-Devel] Hi: Startpoint/Endpoint X and Y with BeanShell
Hi Michaël, Thanks a lot for the improvements. However, I would like to ask you to help with one more fix. Now the script fires the requests automatically and it is dangerous if user has selected a layer with thousands of features. Could you show how to limit the maximum number of requests to 10? Generally it is good to be able to do several routings at a time because it gives a simple way for the user to use interim fixed route points by digitizing the route as connected lines but I think that 10 legs should be enough. -Jukka Rahkonen- Michaël Michaud wrote: Hi Jukka, Good job, With a few more lines, you can get the path in your map (hereafter, kml parsing is very crude, but it shows how powerful beanshell scripting can be). { import com.vividsolutions.jts.geom.*; import com.vividsolutions.jts.io.WKTReader; import com.vividsolutions.jump.feature.*; import com.vividsolutions.jump.geom.EnvelopeUtil; import com.vividsolutions.jump.workbench.model.*; import java.io.*; import java.net.URL; fc = wc.getLayerNamePanel().getSelectedLayers()[0].getFeatureCollectionWrap per(); paths = new ArrayList();; for (Iterator i = fc.getFeatures().iterator(); i.hasNext();) { Feature feature = (Feature) i.next(); LineString lineString = (LineString)feature.getGeometry(); URL url; try { // get URL content url = new URL(http://www.yournavigation.org/api/1.0/gosmore.php?format=kmlfla t= +lineString.getStartPoint().getY()+flon= +lineString.getStartPoint().getX()+tlat= +lineString.getEndPoint().getY()+tlon= +lineString.getEndPoint().getX() +v=motorcar +fast=1 +layer=mapnik); print(url); URLConnection conn = url.openConnection(); // open the stream and put it into BufferedReader BufferedReader br = new BufferedReader( new InputStreamReader(conn.getInputStream())); String inputLine; StringBuffer sb = new StringBuffer(); while ((inputLine = br.readLine()) != null) { sb.append(inputLine).append(\n); } wkt = sb.toString() .replaceAll((?s).*coordinates\\s*, LINESTRING() .replaceAll((?s)\\s*/coordinates.*, )) .replaceAll((?s)\\s+, @) .replaceAll((?s),, ) .replaceAll((?s)@, ,); print(wkt); bf = new BasicFeature(fc.getFeatureSchema()); bf.setGeometry(new WKTReader().read(wkt)); paths.add(bf); br.close(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } fc.addAll(paths); } Michaël Hi, Here is a demo script which finds route from the service or yournavigation.org. Save the following code into lib\ext\BeanTools, draw one or more lines with OpenJUMP by using EPSG:4326 system, run the tool and copy the URLs from the result window into browser and you will get the routes in KML format. Script creates a request which follows the YOURS syntax http://wiki.openstreetmap.org/wiki/YOURS and it is simple to modify to use other YOURS parameters. I also made another version which is getting routes from the service of the Helsinki Region Traffic and it works fine too. With a little bit of work it should be possible to make an OpenJUMP routing service plugin. Creating a request is easy but a very good plugin should be able to handle coordinate conversions between OJ project coordinate system and the one used by the routing service. And then OpenJUMP should be able to parse the returning route which is typically in GPX or KML format. However, I tested also a workaround by using GDAL in between. OpenJUMP can create a ogr2ogr request and ogr2ogr can save the result as a shapefile and possibly converted into another projection. Get_YOURS_Route.bsh == { import com.vividsolutions.jts.geom.*; import com.vividsolutions.jump.feature.*; import com.vividsolutions.jump.geom.EnvelopeUtil; import com.vividsolutions.jump.workbench.model.*; htmlFrame = wc.workbench.frame.outputFrame; htmlFrame.createNewDocument(); htmlFrame.setTitle(Output for gdal_translate); fc = wc.getLayerNamePanel().getSelectedLayers()[0].getFeatureCollectionWrap per(); int j=1; for (Iterator i = fc.getFeatures().iterator(); i.hasNext();) { Feature feature = (Feature) i.next(); LineString lineString = (LineString)feature.getGeometry();
Re: [JPP-Devel] OJ 3416 Two compiler errors (Parser.java and ConnectionManagerToolboxPlugIn)
Hi Ede, is it possible, that you work with xercesImpl-2.8.1.jar and not with xercesImpl.jar? When I compile with xercesImpl-2.8.1.jar there is no error. The lib directoty from http://jump-pilot.svn.sourceforge.net/viewvc/jump-pilot/core/trunk/lib/ is not consistent with the lib from http://sourceforge.net/projects/jump-pilot/files/OpenJUMP_snapshots/ In http://jump-pilot.svn.sourceforge.net/viewvc/jump-pilot/core/trunk/lib/ there are some old .jar files. Is that correct? Uwe Am 28.03.2013 14:44, schrieb edgar.sol...@web.de: just did as you said. 1. create a fresh java project 2. extract lib/src downloads from http://jump-pilot.svn.sourceforge.net/viewvc/jump-pilot/core/trunk/src/?view=tarpathrev=3416 http://jump-pilot.svn.sourceforge.net/viewvc/jump-pilot/core/trunk/lib/?view=tarpathrev=3416 into the appropriate folders 3. add all jars in lib/ to buildpath 4. compiles fine runs ..ede On 28.03.2013 14:33, edgar.sol...@web.de wrote: check if you have other versions of 'xercesImpl.jar' on your machine in general. probably under Programs/Java or somewhere else. make sure that only this on of your downloaded checkout is used in buildpath. ..ede On 28.03.2013 14:29, Uwe Dalluege wrote: This is a fresh test-project. Only the lib and the src directory from http://jump-pilot.svn.sourceforge.net/viewvc/jump-pilot/core/trunk/?pathrev=3416 Uwe Am 28.03.2013 14:22, schrieb edgar.sol...@web.de: On 28.03.2013 14:02, Uwe Dalluege wrote: After unpack these files to lib and scr and try to make an eclipse-project from the source I got two errors: 1. In Parser.java line 316 The method createLSSerializer() is undefined for the type DOMImplementationLSParser.java /OJ16_3416eclipse/src/com/vividsolutions/wmsline 316Java Problem looks like you have bogus xml jars in your path. is this a fresh project? if not, did you clean out the old libs and added only the new ones to buildpath? ..ede -- Own the Future-Intelreg; Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game demo contest. Compete for recognition, cash, and the chance to get your game on Steam. $5K grand prize plus 10 genre and skill prizes. Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d ___ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel -- Own the Future-Intelreg; Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game demo contest. Compete for recognition, cash, and the chance to get your game on Steam. $5K grand prize plus 10 genre and skill prizes. Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d ___ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel -- Own the Future-Intelreg; Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game demo contest. Compete for recognition, cash, and the chance to get your game on Steam. $5K grand prize plus 10 genre and skill prizes. Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d ___ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel -- Own the Future-Intel(R) Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game demo contest. Compete for recognition, cash, and the chance to get your game on Steam. $5K grand prize plus 10 genre and skill prizes. Submit your demo by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2 ___ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
Re: [JPP-Devel] Extent calculation
Hi Michaël, I made a small test and I can always reproduce an error. I think it is better to make more tests *after* you find this bug: 1. Run this in pgAdminIII (without creating indices!): drop table if exists t_line_invis; CREATE TABLE t_line_invis ( lnr integer, geom geometry ( LINESTRING, 0 ) ); INSERT INTO t_line_invis VALUES ( 1, ST_GeometryFromText ( 'LINESTRING ( 2000.0 2000.0, 2500.0 2300.0, 2100.0 2500.0 )', 0 ) ); INSERT INTO t_line_invis VALUES ( 2, ST_GeometryFromText ( 'LINESTRING ( 1000.0 1000.0, 1500.0 1300.0, 1100.0 1500.0 )', 0 ) ); 2. Start OJ (3458) with a small project-window (459, 346). 3. Open Data Store Layer and load the table t_line_invis. 4. The error No description was provided appears. 5. Click at View/Edit Attributes. The table is empty. 6. Zoom To Full Extent now I see the geometry and after View/Edit Attributes the table was not empty. 7. LeftClick inside the table and the InternalError appears (but I think, this is an old problem and has nothing to do with PostGIS): java.lang.InternalError: Unable to Stroke shape (attempt to validate Pipe with invalid SurfaceData) at sun.java2d.pipe.LoopPipe.getStrokeSpans(Unknown Source) at sun.java2d.pipe.LoopPipe.draw(Unknown Source) at sun.java2d.pipe.ValidatePipe.draw(Unknown Source) at sun.java2d.SunGraphics2D.draw(Unknown Source) at com.vividsolutions.jump.workbench.ui.LayerViewPanel$6.run(LayerViewPanel.java:742) at com.vividsolutions.jump.workbench.ui.GUIUtil.invokeOnEventThread(GUIUtil.java:612) at com.vividsolutions.jump.workbench.ui.LayerViewPanel.flash(LayerViewPanel.java:739) at com.vividsolutions.jump.workbench.ui.LayerViewPanel.flash(LayerViewPanel.java:771) at com.vividsolutions.jump.workbench.ui.zoom.ZoomToSelectedItemsPlugIn.flash(ZoomToSelectedItemsPlugIn.java:189) at com.vividsolutions.jump.workbench.ui.AttributePanel$2.mouseClicked(AttributePanel.java:196) at java.awt.AWTEventMulticaster.mouseClicked(Unknown Source) at java.awt.AWTEventMulticaster.mouseClicked(Unknown Source) at java.awt.AWTEventMulticaster.mouseClicked(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$200(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) Uwe Am 31.03.2013 14:11, schrieb Michaël Michaud: Hi Uwe, I made two improvements to try to solve the extent calculation problem (see r3439). Note : I don't know if you still have the WKB 0 bug. Add a VACUMM ANALYZE theNewTable after creation of a new table why ? It seems that the index creation is not enough to use ST_Estimated_Extent just after the table creation Test if the geometry column we want to use is indexed with a spatial index to determine if ST_Estimated_Extent or ST_Extent must be used. (it was quite difficult to know if a column is spatially indexed). Please try extensively, Michaël Hi, OK, I see, There are 2 methods to get the envelope in the code : ST_Estimated_Extent (fast, not precise,
Re: [JPP-Devel] Reading zipped shapefiles by URL
On 02.04.2013 07:10, Rahkonen Jukka wrote: Hi, Michaël made OpenJUMP to read a routing solution in KML format directly from the web by URL. Is it possible to read zipped shapefiles in the same way for example from http://kartat.kapsi.fi/files/maastotietokanta/kaikki/etrs89/shp/M5/M53/M53122.shp.zip ? depends on the the internal zip opening routine of the jre. at least for zips i guess it could be possible as the jre can start jars from webservers. want to add a feature request? we would probably need a Open from Url dialog for that. Want to do by script in between? never tried the beanscripting. Michael any idea? Do you have a bean script that opens a shp file to start with? ..ede -- Own the Future-Intel(R) Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game demo contest. Compete for recognition, cash, and the chance to get your game on Steam. $5K grand prize plus 10 genre and skill prizes. Submit your demo by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2 ___ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
Re: [JPP-Devel] OJ 3416 Two compiler errors (Parser.java and ConnectionManagerToolboxPlugIn)
Hi, which files are old? for instance: Jama-1.0.1.jar (19.06.2007) - jama-1.0.2.jar (26.09.2011) in zip. jythom.jar (16.02.2009) - jython-2.2.jar (26.09.2011) in zip. xercesImpl.jar (19.06.2007) - xercesImpl-2.8.1.jar (26.09.2011) in zip xml-apis.jar (19.06.2007) - xml-apis-1.3.03.jar (26.09.2011) in zip xml-apis-ext.jar (19.06.2007) - xmlParserAPIs-2.0.2.jar (26.09.2011) in zip? uwe Am 02.04.2013 14:28, schrieb edgar.sol...@web.de: On 02.04.2013 13:29, Uwe Dalluege wrote: Hi Ede, hola Uwe, is it possible, that you work with xercesImpl-2.8.1.jar and not with xercesImpl.jar? When I compile with xercesImpl-2.8.1.jar there is no error. nope, i use xercesImpl.jar from svn. see attached. svn's xercesImpl.jar is 2.5.0. dunno why it ain't working for you, does for me. The lib directoty from http://jump-pilot.svn.sourceforge.net/viewvc/jump-pilot/core/trunk/lib/ is not consistent with the lib from http://sourceforge.net/projects/jump-pilot/files/OpenJUMP_snapshots/ In http://jump-pilot.svn.sourceforge.net/viewvc/jump-pilot/core/trunk/lib/ there are some old .jar files. Is that correct? ideally the versions should be identical. however it can be that they are not because somebody updated maven but not the svn/lib folder in the past. some jar files e.g. batik are packaged together for convenience. which files are old? ..ede -- Own the Future-Intel(R) Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game demo contest. Compete for recognition, cash, and the chance to get your game on Steam. $5K grand prize plus 10 genre and skill prizes. Submit your demo by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2 ___ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel -- Own the Future-Intel(R) Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game demo contest. Compete for recognition, cash, and the chance to get your game on Steam. $5K grand prize plus 10 genre and skill prizes. Submit your demo by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2 ___ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
[JPP-Devel] Broken Link to new OpenJUMP Programmer's Manual
Hi, on the page http://sourceforge.net/apps/mediawiki/jump-pilot/index.php?title=Developer_Documentation_and_HowTo is a broken link to: new OpenJUMP Programmer's Manual (under General Docs) Uwe -- Own the Future-Intel(R) Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game demo contest. Compete for recognition, cash, and the chance to get your game on Steam. $5K grand prize plus 10 genre and skill prizes. Submit your demo by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2 ___ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
Re: [JPP-Devel] OJ 3416 Two compiler errors (Parser.java and ConnectionManagerToolboxPlugIn)
On 02.04.2013 14:46, Uwe Dalluege wrote: Hi, which files are old? for instance: Jama-1.0.1.jar (19.06.2007) - jama-1.0.2.jar (26.09.2011) in zip. jythom.jar (16.02.2009) - jython-2.2.jar (26.09.2011) in zip. xercesImpl.jar (19.06.2007) - xercesImpl-2.8.1.jar (26.09.2011) in zip xml-apis.jar (19.06.2007) - xml-apis-1.3.03.jar (26.09.2011) in zip xml-apis-ext.jar (19.06.2007) - xmlParserAPIs-2.0.2.jar (26.09.2011) in zip? thnaks.. just updated the svn accordingly. ..ede -- Own the Future-Intel(R) Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game demo contest. Compete for recognition, cash, and the chance to get your game on Steam. $5K grand prize plus 10 genre and skill prizes. Submit your demo by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2 ___ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
Re: [JPP-Devel] Hi: Startpoint/Endpoint X and Y with BeanShell
Hi, Thanks a lot for the improvements. However, I would like to ask you to help with one more fix. Now the script fires the requests automatically and it is dangerous if user has selected a layer with thousands of features. Could you show how to limit the maximum number of requests to 10? Generally it is good to be able to do several routings at a time because it gives a simple way for the user to use interim fixed route points by digitizing the route as connected lines but I think that 10 legs should be enough. I see, In your initial script, there was a counter. I removed it, but you can add it again and use it this way. count = 0; for (Iterator it = ) { if (count++ 10) break; } Also an improvement I was too lazy to do is to put result in a new layer... Michaël -Jukka Rahkonen- Michaël Michaud wrote: Hi Jukka, Good job, With a few more lines, you can get the path in your map (hereafter, kml parsing is very crude, but it shows how powerful beanshell scripting can be). { import com.vividsolutions.jts.geom.*; import com.vividsolutions.jts.io.WKTReader; import com.vividsolutions.jump.feature.*; import com.vividsolutions.jump.geom.EnvelopeUtil; import com.vividsolutions.jump.workbench.model.*; import java.io.*; import java.net.URL; fc = wc.getLayerNamePanel().getSelectedLayers()[0].getFeatureCollectionWrap per(); paths = new ArrayList();; for (Iterator i = fc.getFeatures().iterator(); i.hasNext();) { Feature feature = (Feature) i.next(); LineString lineString = (LineString)feature.getGeometry(); URL url; try { // get URL content url = new URL(http://www.yournavigation.org/api/1.0/gosmore.php?format=kmlfla t= +lineString.getStartPoint().getY()+flon= +lineString.getStartPoint().getX()+tlat= +lineString.getEndPoint().getY()+tlon= +lineString.getEndPoint().getX() +v=motorcar +fast=1 +layer=mapnik); print(url); URLConnection conn = url.openConnection(); // open the stream and put it into BufferedReader BufferedReader br = new BufferedReader( new InputStreamReader(conn.getInputStream())); String inputLine; StringBuffer sb = new StringBuffer(); while ((inputLine = br.readLine()) != null) { sb.append(inputLine).append(\n); } wkt = sb.toString() .replaceAll((?s).*coordinates\\s*, LINESTRING() .replaceAll((?s)\\s*/coordinates.*, )) .replaceAll((?s)\\s+, @) .replaceAll((?s),, ) .replaceAll((?s)@, ,); print(wkt); bf = new BasicFeature(fc.getFeatureSchema()); bf.setGeometry(new WKTReader().read(wkt)); paths.add(bf); br.close(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } fc.addAll(paths); } Michaël Hi, Here is a demo script which finds route from the service or yournavigation.org. Save the following code into lib\ext\BeanTools, draw one or more lines with OpenJUMP by using EPSG:4326 system, run the tool and copy the URLs from the result window into browser and you will get the routes in KML format. Script creates a request which follows the YOURS syntax http://wiki.openstreetmap.org/wiki/YOURS and it is simple to modify to use other YOURS parameters. I also made another version which is getting routes from the service of the Helsinki Region Traffic and it works fine too. With a little bit of work it should be possible to make an OpenJUMP routing service plugin. Creating a request is easy but a very good plugin should be able to handle coordinate conversions between OJ project coordinate system and the one used by the routing service. And then OpenJUMP should be able to parse the returning route which is typically in GPX or KML format. However, I tested also a workaround by using GDAL in between. OpenJUMP can create a ogr2ogr request and ogr2ogr can save the result as a shapefile and possibly converted into another projection. Get_YOURS_Route.bsh == { import com.vividsolutions.jts.geom.*; import com.vividsolutions.jump.feature.*; import com.vividsolutions.jump.geom.EnvelopeUtil; import com.vividsolutions.jump.workbench.model.*; htmlFrame = wc.workbench.frame.outputFrame; htmlFrame.createNewDocument(); htmlFrame.setTitle(Output for gdal_translate); fc = wc.getLayerNamePanel().getSelectedLayers()[0].getFeatureCollectionWrap per(); int
Re: [JPP-Devel] Broken Link to new OpenJUMP Programmer's Manual
Hi, on the page http://sourceforge.net/apps/mediawiki/jump-pilot/index.php?title=Developer_Documentation_and_HowTo is a broken link to: is broken ? or has broken link ? (I cannot see new OpenJUMP Programmer's Manual under Gneral Docs) new OpenJUMP Programmer's Manual (under General Docs) Michaël Uwe -- Own the Future-Intel(R) Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game demo contest. Compete for recognition, cash, and the chance to get your game on Steam. $5K grand prize plus 10 genre and skill prizes. Submit your demo by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2 ___ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel -- Minimize network downtime and maximize team effectiveness. Reduce network management and security costs.Learn how to hire the most talented Cisco Certified professionals. Visit the Employer Resources Portal http://www.cisco.com/web/learning/employer_resources/index.html ___ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
Re: [JPP-Devel] Broken Link to new OpenJUMP Programmer's Manual
On 02.04.2013 20:23, Michaël Michaud wrote: Hi, on the page http://sourceforge.net/apps/mediawiki/jump-pilot/index.php?title=Developer_Documentation_and_HowTo is a broken link to: is broken ? or has broken link ? (I cannot see new OpenJUMP Programmer's Manual under Gneral Docs) new OpenJUMP Programmer's Manual (under General Docs) Mohammad renamed it to 'OpenJUMP API Manual' .. ede -- Minimize network downtime and maximize team effectiveness. Reduce network management and security costs.Learn how to hire the most talented Cisco Certified professionals. Visit the Employer Resources Portal http://www.cisco.com/web/learning/employer_resources/index.html ___ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
Re: [JPP-Devel] Broken Link to new OpenJUMP Programmer's Manual
On 02.04.2013 20:27, edgar.sol...@web.de wrote: On 02.04.2013 20:23, Michaël Michaud wrote: Hi, on the page http://sourceforge.net/apps/mediawiki/jump-pilot/index.php?title=Developer_Documentation_and_HowTo is a broken link to: is broken ? or has broken link ? (I cannot see new OpenJUMP Programmer's Manual under Gneral Docs) new OpenJUMP Programmer's Manual (under General Docs) Mohammad renamed it to 'OpenJUMP API Manual' .. ede moved it to Basics under the javadoc as 'OpenJUMP svn repository doxygen doc' as it is generally no manual but javadoc on speed ran over the whole repository. https://sourceforge.net/apps/mediawiki/jump-pilot/index.php?title=Developer_Documentation_and_HowTo#Basics .ede -- Minimize network downtime and maximize team effectiveness. Reduce network management and security costs.Learn how to hire the most talented Cisco Certified professionals. Visit the Employer Resources Portal http://www.cisco.com/web/learning/employer_resources/index.html ___ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
Re: [JPP-Devel] Extent calculation
Hi Uwe, I made a small test and I can always reproduce an error. I think it is better to make more tests *after* you find this bug: 1. Run this in pgAdminIII (without creating indices!): drop table if exists t_line_invis; CREATE TABLE t_line_invis ( lnr integer, geom geometry ( LINESTRING, 0 ) ); INSERT INTO t_line_invis VALUES ( 1, ST_GeometryFromText ( 'LINESTRING ( 2000.0 2000.0, 2500.0 2300.0, 2100.0 2500.0 )', 0 ) ); INSERT INTO t_line_invis VALUES ( 2, ST_GeometryFromText ( 'LINESTRING ( 1000.0 1000.0, 1500.0 1300.0, 1100.0 1500.0 )', 0 ) ); 2. Start OJ (3458) with a small project-window (459, 346). 3. Open Data Store Layer and load the table t_line_invis. 4. The error No description was provided appears. I did not get this error. Have you more information in the log ? Can you reproduce it always ? 5. Click at View/Edit Attributes. The table is empty. This is how datastore works : it load data intersecting the current view. 6. Zoom To Full Extent now I see the geometry and after View/Edit Attributes the table was not empty. Use the extent calculated by ST_Estimated_Extent (or ST_Extent) and load features intersecting the extent (all the features) 7. LeftClick inside the table and the InternalError appears (but I think, this is an old problem and has nothing to do with PostGIS): Yes, an old problem appearing sometimes the first time OJ tries to drow a shape. Except 4. that I can't reproduce, and the following Stroke bug, other behaviour is desired. As I've already said, we could include zoom to full extent just after setting a connection to a new dataset, but It would make impossible to connect to a dataset containing millions of features. An improvement could be to zoom to the first feature... Michaël java.lang.InternalError: Unable to Stroke shape (attempt to validate Pipe with invalid SurfaceData) at sun.java2d.pipe.LoopPipe.getStrokeSpans(Unknown Source) at sun.java2d.pipe.LoopPipe.draw(Unknown Source) at sun.java2d.pipe.ValidatePipe.draw(Unknown Source) at sun.java2d.SunGraphics2D.draw(Unknown Source) at com.vividsolutions.jump.workbench.ui.LayerViewPanel$6.run(LayerViewPanel.java:742) at com.vividsolutions.jump.workbench.ui.GUIUtil.invokeOnEventThread(GUIUtil.java:612) at com.vividsolutions.jump.workbench.ui.LayerViewPanel.flash(LayerViewPanel.java:739) at com.vividsolutions.jump.workbench.ui.LayerViewPanel.flash(LayerViewPanel.java:771) at com.vividsolutions.jump.workbench.ui.zoom.ZoomToSelectedItemsPlugIn.flash(ZoomToSelectedItemsPlugIn.java:189) at com.vividsolutions.jump.workbench.ui.AttributePanel$2.mouseClicked(AttributePanel.java:196) at java.awt.AWTEventMulticaster.mouseClicked(Unknown Source) at java.awt.AWTEventMulticaster.mouseClicked(Unknown Source) at java.awt.AWTEventMulticaster.mouseClicked(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$200(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) Uwe Am 31.03.2013 14:11, schrieb Michaël Michaud: Hi Uwe, I made two improvements to try to solve the
Re: [JPP-Devel] Startpoint/Endpoint X and Y with BeanShell
Hi, I placed counter like this paths = new ArrayList();; count = 0; for (Iterator i = fc.getFeatures().iterator(); i.hasNext();) { Feature feature = (Feature) i.next(); LineString lineString = (LineString)feature.getGeometry(); URL url; try { ...SNIP... br.close(); if (count++ 5) break; } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } fc.addAll(paths); } I am not sure if the place is correct but it seems to limit how many linestrings are handled. However, I am not sure if the routing solutions are coming in the same order than the legs to route if they are digitized as A-B, B-C, C-D, D-E etc. The initial script is actually also by you. You made it a few years ago for building Web Coverage Service requests. -Jukka- Michaël Michaud wrote: Hi, Thanks a lot for the improvements. However, I would like to ask you to help with one more fix. Now the script fires the requests automatically and it is dangerous if user has selected a layer with thousands of features. Could you show how to limit the maximum number of requests to 10? Generally it is good to be able to do several routings at a time because it gives a simple way for the user to use interim fixed route points by digitizing the route as connected lines but I think that 10 legs should be enough. I see, In your initial script, there was a counter. I removed it, but you can add it again and use it this way. count = 0; for (Iterator it = ) { if (count++ 10) break; } Also an improvement I was too lazy to do is to put result in a new layer... Michaël -Jukka Rahkonen- Michaël Michaud wrote: Hi Jukka, Good job, With a few more lines, you can get the path in your map (hereafter, kml parsing is very crude, but it shows how powerful beanshell scripting can be). { import com.vividsolutions.jts.geom.*; import com.vividsolutions.jts.io.WKTReader; import com.vividsolutions.jump.feature.*; import com.vividsolutions.jump.geom.EnvelopeUtil; import com.vividsolutions.jump.workbench.model.*; import java.io.*; import java.net.URL; fc = wc.getLayerNamePanel().getSelectedLayers()[0].getFeatureCollectionWrap per(); paths = new ArrayList();; for (Iterator i = fc.getFeatures().iterator(); i.hasNext();) { Feature feature = (Feature) i.next(); LineString lineString = (LineString)feature.getGeometry(); URL url; try { // get URL content url = new URL(http://www.yournavigation.org/api/1.0/gosmore.php?format=kmlfla t= +lineString.getStartPoint().getY()+flon= +lineString.getStartPoint().getX()+tlat= +lineString.getEndPoint().getY()+tlon= +lineString.getEndPoint().getX() +v=motorcar +fast=1 +layer=mapnik); print(url); URLConnection conn = url.openConnection(); // open the stream and put it into BufferedReader BufferedReader br = new BufferedReader( new InputStreamReader(conn.getInputStream())); String inputLine; StringBuffer sb = new StringBuffer(); while ((inputLine = br.readLine()) != null) { sb.append(inputLine).append(\n); } wkt = sb.toString() .replaceAll((?s).*coordinates\\s*, LINESTRING() .replaceAll((?s)\\s*/coordinates.*, )) .replaceAll((?s)\\s+, @) .replaceAll((?s),, ) .replaceAll((?s)@, ,); print(wkt); bf = new BasicFeature(fc.getFeatureSchema()); bf.setGeometry(new WKTReader().read(wkt)); paths.add(bf); br.close(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } fc.addAll(paths); } Michaël Hi, Here is a demo script which finds route from the service or yournavigation.org. Save the following code into lib\ext\BeanTools, draw one or more lines with OpenJUMP by using EPSG:4326 system, run the tool and copy the URLs from the result window into browser and you will get the routes in KML format. Script creates a request which follows the YOURS syntax http://wiki.openstreetmap.org/wiki/YOURS and it is simple to modify to use other YOURS parameters. I also made another version which is getting routes from the service of the Helsinki Region Traffic and it works fine too. With a little bit of work it should be possible to make an
Re: [JPP-Devel] Extent calculation
Hi Michaël, Am 02.04.2013 20:40, schrieb Michaël Michaud: Hi Uwe, I made a small test and I can always reproduce an error. I think it is better to make more tests *after* you find this bug: 1. Run this in pgAdminIII (without creating indices!): drop table if exists t_line_invis; CREATE TABLE t_line_invis ( lnr integer, geom geometry ( LINESTRING, 0 ) ); INSERT INTO t_line_invis VALUES ( 1, ST_GeometryFromText ( 'LINESTRING ( 2000.0 2000.0, 2500.0 2300.0, 2100.0 2500.0 )', 0 ) ); INSERT INTO t_line_invis VALUES ( 2, ST_GeometryFromText ( 'LINESTRING ( 1000.0 1000.0, 1500.0 1300.0, 1100.0 1500.0 )', 0 ) ); 2. Start OJ (3458) with a small project-window (459, 346). 3. Open Data Store Layer and load the table t_line_invis. 4. The error No description was provided appears. I did not get this error. Have you more information in the log ? Can you reproduce it always ? Yes, I can reproduce it always. Here is my log-file: 2013-04-03 07:17:41,307 WARN class org.openjump.core.ui.plugin.file.SaveImageAsSVGPlugIn could not be initialized 2013-04-03 07:17:41,307 INFO java.lang.NoClassDefFoundError: org/apache/batik/svggen/SVGGraphics2D 2013-04-03 07:17:42,898 WARN ECW loader class com.ermapper.ecw.JNCSRenderer not installed. 2013-04-03 07:17:42,914 WARN ECW loader class com.ermapper.ecw.JNCSRenderer not installed. 2013-04-03 07:17:42,914 WARN lib\ext\etc\mrsidgeodecode.exe not installed. 2013-04-03 07:17:43,452 INFO Activating Select Features Tool 2013-04-03 07:17:43,452 INFO Activating Select Features Tool 2013-04-03 07:17:43,452 INFO Activating Select Features Tool 2013-04-03 07:17:45,784 INFO Executing Open... 2013-04-03 07:17:52,149 INFO Done. Current committed memory: 35 MB 2013-04-03 07:17:52,149 INFO Activating Select Features Tool 2013-04-03 07:19:12,582 WARN class org.openjump.core.ui.plugin.file.SaveImageAsSVGPlugIn could not be initialized 2013-04-03 07:19:12,582 INFO java.lang.NoClassDefFoundError: org/apache/batik/svggen/SVGGraphics2D 2013-04-03 07:19:14,096 WARN ECW loader class com.ermapper.ecw.JNCSRenderer not installed. 2013-04-03 07:19:14,096 WARN ECW loader class com.ermapper.ecw.JNCSRenderer not installed. 2013-04-03 07:19:14,111 WARN lib\ext\etc\mrsidgeodecode.exe not installed. 2013-04-03 07:19:14,649 INFO Activating Select Features Tool 2013-04-03 07:19:14,649 INFO Activating Select Features Tool 2013-04-03 07:19:14,649 INFO Activating Select Features Tool 2013-04-03 07:19:17,980 INFO Executing Open... 2013-04-03 07:19:22,894 INFO Executing Retrieving list of datasets. 2013-04-03 07:19:23,050 INFO Done. Current committed memory: 44 MB 2013-04-03 07:19:29,774 INFO Executing Retrieving list of geometry attributes. 2013-04-03 07:19:29,852 INFO Done. Current committed memory: 45 MB 2013-04-03 07:19:31,864 INFO Activating Select Features Tool 2013-04-03 07:19:31,973 INFO Done. Current committed memory: 48 MB 2013-04-03 07:19:32,005 INFO Activating Select Features Tool 2013-04-03 07:19:32,051 INFO Warning: No description was provided. (No Such Element Exception) 5. Click at View/Edit Attributes. The table is empty. This is how datastore works : it load data intersecting the current view. 6. Zoom To Full Extent now I see the geometry and after View/Edit Attributes the table was not empty. Use the extent calculated by ST_Estimated_Extent (or ST_Extent) and load features intersecting the extent (all the features) 7. LeftClick inside the table and the InternalError appears (but I think, this is an old problem and has nothing to do with PostGIS): Yes, an old problem appearing sometimes the first time OJ tries to drow a shape. Except 4. that I can't reproduce, and the following Stroke bug, other behaviour is desired. As I've already said, we could include zoom to full extent just after setting a connection to a new dataset, but It would make impossible to connect to a dataset containing millions of features. An improvement could be to zoom to the first feature... Maybe you can count the rows in the table and if there are more than millions or so, you can avoid to zoom? What do you think? Uwe Michaël java.lang.InternalError: Unable to Stroke shape (attempt to validate Pipe with invalid SurfaceData) at sun.java2d.pipe.LoopPipe.getStrokeSpans(Unknown Source) at sun.java2d.pipe.LoopPipe.draw(Unknown Source) at sun.java2d.pipe.ValidatePipe.draw(Unknown Source) at sun.java2d.SunGraphics2D.draw(Unknown Source) at com.vividsolutions.jump.workbench.ui.LayerViewPanel$6.run(LayerViewPanel.java:742) at com.vividsolutions.jump.workbench.ui.GUIUtil.invokeOnEventThread(GUIUtil.java:612) at com.vividsolutions.jump.workbench.ui.LayerViewPanel.flash(LayerViewPanel.java:739) at com.vividsolutions.jump.workbench.ui.LayerViewPanel.flash(LayerViewPanel.java:771) at com.vividsolutions.jump.workbench.ui.zoom.ZoomToSelectedItemsPlugIn.flash(ZoomToSelectedItemsPlugIn.java:189)