Hi Thomas, you don't have any projection file (prj) for your shapefile. That seems to be the problem.
In the prj you can put the WKT representation of your coordinate system. Andrea On Fri, Nov 20, 2015 at 8:51 PM, Thomas Wunder <fo...@thomas-wunder.de> wrote: > Hello, > > 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.<init>(App.java:47) > at org.geotools.JSurveyMvn.App.main(App.java:58) > > When trying to explicitly set a CRS directly after associating the (empty) > MapContext 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.<init>(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? > > Attached is the source code of an example application that demonstrates the > problem (run under linux (amd64) using getools v. 14.0) as well as the > shapefile. > > Thanks in advance and best regards! > Thomas > > > ------------------------------------------------------------------------------ > > _______________________________________________ > GeoTools-GT2-Users mailing list > GeoTools-GT2-Users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users > ------------------------------------------------------------------------------ Go from Idea to Many App Stores Faster with Intel(R) XDK Give your users amazing mobile app experiences with Intel(R) XDK. Use one codebase in this all-in-one HTML5 development environment. Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs. http://pubads.g.doubleclick.net/gampad/clk?id=254741551&iu=/4140 _______________________________________________ GeoTools-GT2-Users mailing list GeoTools-GT2-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users