I'm quite new to geotools and I'm trying to get to grips with it.Trying to load some shapefiles (see attachment) into a MapContent which in turn is associated with a SwtMapPane I always get an exception that suggests that there's something wrong with the current CRS of the map pane:java.lang.IllegalArgumentException: Argument "sourceCRS" should not be null. at org.geotools.referencing.operation.AbstractCoordinateOperationFactory.ensureNonNull(AbstractCoordinateOperationFactory.java:734) at org.geotools.referencing.operation.BufferedCoordinateOperationFactory.createOperation(BufferedCoordinateOperationFactory.java:249) at org.geotools.referencing.CRS.findMathTransform(CRS.java:1205) at org.geotools.referencing.CRS.findMathTransform(CRS.java:1173) at org.geotools.swt.SwtMapPane.setCrs(SwtMapPane.java:436) at org.geotools.swt.SwtMapPane.layerAdded(SwtMapPane.java:812) at org.geotools.map.MapContent.fireLayerAdded(MapContent.java:468) at org.geotools.map.MapContent$LayerList.addIfAbsent(MapContent.java:1063) at org.geotools.map.MapContent.addLayer(MapContent.java:369) at org.geotools.JSurveyMvn.App.fileOpen(App.java:87) at org.geotools.JSurveyMvn.App$1.widgetSelected(App.java:113) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:234) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3540) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3161) at org.eclipse.jface.window.Window.runEventLoop(Window.java:825) at org.eclipse.jface.window.Window.open(Window.java:801) at org.geotools.JSurveyMvn.App.(App.java:47) at org.geotools.JSurveyMvn.App.main(App.java:58)
When trying to explicitly set a CRS directly after associating the (empty) MapContent to the map pane (see line 149), I'll get a NullPointerException like that:java.lang.NullPointerException at org.geotools.swt.SwtMapPane.setCrs(SwtMapPane.java:433) at org.geotools.JSurveyMvn.App.createContents(App.java:152) at org.eclipse.jface.window.Window.create(Window.java:431) at org.eclipse.jface.window.Window.open(Window.java:790) at org.geotools.JSurveyMvn.App.(App.java:47) at org.geotools.JSurveyMvn.App.main(App.java:58)I'm quite desparate of being unable to solve that problem. Can you please give me a hand to make it work?
Obviously it's not possible to attach files here. So here's my original post to the Geotools-gt2-users list which seems to be inactive but allows adding code and map samples: http://sourceforge.net/p/geotools/mailman/message/34635944/ Attached is the source code of an example application that demonstrates the problem (run under linux (amd64) using getools v. 13.3 or 14.0) as well as the shapefile.
Thanks in advance and best regards! Thomas
أكثر...
When trying to explicitly set a CRS directly after associating the (empty) MapContent to the map pane (see line 149), I'll get a NullPointerException like that:java.lang.NullPointerException at org.geotools.swt.SwtMapPane.setCrs(SwtMapPane.java:433) at org.geotools.JSurveyMvn.App.createContents(App.java:152) at org.eclipse.jface.window.Window.create(Window.java:431) at org.eclipse.jface.window.Window.open(Window.java:790) at org.geotools.JSurveyMvn.App.(App.java:47) at org.geotools.JSurveyMvn.App.main(App.java:58)I'm quite desparate of being unable to solve that problem. Can you please give me a hand to make it work?
Obviously it's not possible to attach files here. So here's my original post to the Geotools-gt2-users list which seems to be inactive but allows adding code and map samples: http://sourceforge.net/p/geotools/mailman/message/34635944/ Attached is the source code of an example application that demonstrates the problem (run under linux (amd64) using getools v. 13.3 or 14.0) as well as the shapefile.
Thanks in advance and best regards! Thomas
أكثر...