From: Jeremiah L. <dra...@gm...> - 2010-05-08 21:11:17
|
On Sat, May 8, 2010 at 12:02 PM, Mario22 <mar...@gm...> wrote: > > Hello everybody! > > I just spent 4 hours trying to figure out how to solve this problem with no > success :/ > I have read the topics dealing with similar problems but I have not found a > solution. > > I have a map (SHP file + other files, but .prj file is missing) for which > there is no defined CRS (i tried to find it using > featureCollection.getBounds().getCRS() ) but it results in null. The > coordinates are from an Italian city Ferrara and the bounds are: > Min: > 582180, 72 > 937451,06 > Span: > 277087,18 > 48164,44 > > I also have a set of addresses from that city for which I used Google Maps > API to fetch latitude and longitude. (One example is 44.77816, 11.64028.). > > Now I would like to transfer all my lat/long coordinates to the map > coordinates or vice-versa. > > I have got a couple of questions: > 1.) How can I find out the CRS of my map? > 2.) How can I transform the Google lat/long coordinates to my map > coordinates? > 3.) Is Google using the WGS84?? > > If someone could help me I would be grateful! > > Regards, > Mario Mario, 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. 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. 3) I'm not sure about what CRS the coordinates of the town are, but the coordinates for Google is in EPSG:900913 (unofficial name) or EPSG:3857 both are Spherical Mercator types, which the town coordinates look to be. Not the same CRS, though. You might need the WKT for the CRS to work with it. It's in the GeoTools forums, just look for it. As a word of warning, if you are using a WMSMapLayer, there's a bug in it that makes it so it only accepts and requests maps in the WGS84 CRS, even if the bounding box is for a different CRS. To fix this problem, you need to get a copy of the WMSMapLayer code and alter 4 lines maybe? Like I said, the actual code is at work. Jeremiah |