On Sat, May 8, 2010 at 5:42 PM, Mario22 <[email protected]> wrote:
>
> 1) The CRS of the bounding box or envelope of the map should trickle
> down to all the layers in the map. This is done in the renderer.
>
> The problem is in the fact that on every Feature/Geometry/FeatureSource the
> method getCoordinateReferenceSystem() returns null. I looked into it and I
> noticed that my shapefile
> collection is missing the .prj file in which the CRS is defined. I just
> hoped that it is possible to somehow
> get the CRS (some helper class or something :) )
>
It sounds like you are not telling GeoTools what the projection of
your data is, so it returns null for the CRS. To determine the CRS of
your shapefile you will need to ask your data provider what the
projection is and either generate a .prj file or use the WKT to create
a CRS programatically.
> 2) I don't have my code handy (it's at work), but this is fairly easy
> to do, too. Something about a .transform() in the Layer class, I
> think. Might involve the CRS.transform() function.
>
> I tried to do something like:
> CoordinateReferenceSystem source = CRS.decode("EPSG:900913") but it fails
> with an exception.
> I think I'm missing a dependency. However, if you have it coded somewhere
> please do send it.
Have you looked at the http://www.geotools.org/examples/crslab.html?
The coordinates you indicate you got from Google are not in Spherical
Mercator (unless you are looking a the sea off equatorial Africa) they
are almost certainly in lat/long so you probably need to be converting
to/from a projection like EPSG:4326 (see
http://spatialreference.org/ref/epsg/4326/ for more details).
Ian
--
Ian Turton
------------------------------------------------------------------------------
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users