Hello Andrea,
thanks for your help. I've been experimenting with that .prj file quite a bit 
(it wasn't included in the original download from the surveyor's office). I 
didn't include that file since I had to create it on my own (I was unsure 
whether it's correct that way or even necessary). Moreover it did make little 
difference if I added it to the directory with the other files. Exactly the 
same 
Exception is being thrown for the first layer to be added. However for every 
subsequent error it's keeping quiet if (and only if) the first layer had this 
.prj file...

This led me to the question whether I could define an initial CRS manually just 
in case .prj files are absent again in the future...


Attached is the .prj file as well as the files for another layer (without .prj, 
but copy/rename would do, if needed).

Thanks a million!
 Thomas


On Monday 23 November 2015 08:05:17 andrea antonello wrote:
> 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 <[email protected]> 
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.ensu
> > reNonNull(AbstractCoordinateOperationFactory.java:734)> 
> >         at
> > 
> > org.geotools.referencing.operation.BufferedCoordinateOperationFactory.crea
> > teOperation(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:35
> >         40)
> >         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
> > [email protected]
> > 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
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

-- 

PROJCS["DHDN / 3-degree Gauss zone 4", 
  GEOGCS["DHDN", 
    DATUM["Deutsches Hauptdreiecksnetz", 
      SPHEROID["Bessel 1841", 6377397.155, 299.1528128, 
AUTHORITY["EPSG","7004"]], 
      TOWGS84[612.4, 77.0, 440.2, -0.054, 0.057, -2.797, 2.55], 
      AUTHORITY["EPSG","6314"]], 
    PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]], 
    UNIT["degree", 0.017453292519943295], 
    AXIS["Geodetic longitude", EAST], 
    AXIS["Geodetic latitude", NORTH], 
    AUTHORITY["EPSG","4314"]], 
  PROJECTION["Transverse_Mercator", AUTHORITY["EPSG","9807"]], 
  PARAMETER["central_meridian", 12.0], 
  PARAMETER["latitude_of_origin", 0.0], 
  PARAMETER["scale_factor", 1.0], 
  PARAMETER["false_easting", 4500000.0], 
  PARAMETER["false_northing", 0.0], 
  UNIT["m", 1.0], 
  AXIS["Easting", EAST], 
  AXIS["Northing", NORTH], 
  AUTHORITY["EPSG","31464"]]

Attachment: shape_aufnahmepunkte.dbf
Description: application/dbf

Attachment: shape_aufnahmepunkte.shp
Description: application/esri-shape

Attachment: shape_aufnahmepunkte.shx
Description: application/esri-shape-index

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to