From: Emin H. <em...@ha...> - 2005-03-23 20:46:31
|
Rueben, Many thanks for the detailed explanations. I've thought that might be the case, but was not sure. Thing become more clear after your message, however I'm a bit struggling with implementation. You are right, vector data is in WGS84 and I can get that projection information for the raster file too. It is based on old USSR map, so I presume it wouldn't be a big deal to find out. What I was trying to understand is how to use this information to actually set coordinate reference system for the raster layer. Is it done via setCoordinateSystem method of the StyledMapRenderer? Will it not affect all the layers in this case? I couldn't find any way to set coordinate system for raster layer only. If there are any examples for this, that'd be great. Also, general question. What are the pros and cons of mapping raster layer to match vector, rather than doing it other way around? Thanks in advance. Sincerely, Emin Rueben Schulz wrote: >Hello Emin, > >I think you are getting close to the problem. From your description >below, and the image you posted with your original email, I suspect that >the raster data you have is not in geographic coordinates (the world >file is wrong) and instead is projected. Assuming the blue dashed lines >are lines of longitude and latitude, the top left corner of your raster >data has a higher latitude than the top right corner (lines of lat/long >should be straight if the raster was in geographic coordinates). This is >likely the cause of the rotation between your raster and vector data. > >You will need to determine the map projection (and parameters) for the >raster file and the bounding box coordinates in that projection. Once >you set the correct coordinate reference system for the raster layer in >the renderer, it should be able to re-project everything to a common >projection. > >The hard issue is getting the information you need. If the map was >scanned from an atlas (or paper map) it may have projection information >on the bottom of the map (lamber, mercator, ...). If not, you may be >able to guess at the projection and parameters used, based on common >projections used for the region. The bounding box is a bit harder to >calculate. Most maps (ever when projected) only have a lat/long grid >over them. You will need to estimate the lat/long for each corner and >project these coordinates to the projected coordinate system (I may be >able to help you here if you can get the other information). Or if you >are lucky, the map will have coordinates for the corners. > >I assume your vector data is in geographic coordinates (wgs84?) since it >lines up reasonably well. > >Also, I guess that you are using geotools 2.0, but you may be interested >in the WorldImageFormat GridCoverageExchange implementation >(unreleased). It can read an image with a world file and return a grid >coverage. See http://svn.geotools.org/geotools/trunk/gt/plugin/image/ > >Right now the image stuff in svn is a bit broken, but the last build >report says WorldImage build fine. Some information about using the grid >coverage exchange is on the geotools website in the tutorial. > >Rueben > >On Mon, 2005-21-03 at 14:01 +0400, Emin Hasanov wrote: > > >>Martin, >> >>Thanks for your help, I think that is where my problem is - wrong CRS >>setting. I do not currently manually set any particular CRS for my >>vector layer. >>I was playing now with coordinates and have added 3 dots to the vector >>layer - all on the same latitude - and renderer placed them along the >>straight horizontal line. However, I need them to be placed along the >>curved line to match the raster and that is where, as I understand it, >>CS needs to be used. >> >>Any samples on how to achieve it would be grealy appreciated... My >>impression was that I need to use EllipsoidalCS for the layer, but I was >>not able to find proper syntax on how to do this. >> >>Thanks, >>Emin >> >> >> > > > > >------------------------------------------------------- >This SF.net email is sponsored by: 2005 Windows Mobile Application Contest >Submit applications for Windows Mobile(tm)-based Pocket PCs or Smartphones >for the chance to win $25,000 and application distribution. Enter today at >http://ads.osdn.com/?ad_id=6882&alloc_id=15148&op=click >_______________________________________________ >Geotools-gt2-users mailing list >Geo...@li... >https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users > > |