Hi Rasmus,
The first thing to check is that you have your x and y dimensions the
right way round.
Your float matrix should have [row][col] layout, ie. the first
dimension corresponds to world Y axis and the second to world X axis.
Next, your CRS should be constructed so that you get X (longitude), Y
(latitude) order. RT90 has Y,X order so to get it the right way round
you should do: CRS.decode("EPSG:4124", true).
Hope this helps. If not, please post a small example (code + results)
that illustrates the problem.
Michael
On 15 November 2011 10:32, Rasmossen <Rasmossen@...> wrote:
> Hello!
>
> I'm doing a school work where we are making a robot scan a "game area" and
> register obstacles into a raster.
>
> I get the coordinates in RT90:
> I have done following steps:
>
> * Made an CoordinateReferenceSystem (crs) from right EPSG code.
> * Found the lower left corner / top right corner and made a
> ReferencedEnvelope (env).
> * Built a matrix float[height][width] and then constructed an
> GridCoverage2D(cov) from the crs and env.
>
> What i want now is to take an coordinate make it to the right index for the
> matrix so i can build up an cost matrix which will be used to find the
> shortest part from point a and point b.
>
> The problem i find is that the (x,y) i get from
> GridCoverage2D.getGridGeometry().gridToWorld() aren't right.
> I think i get the (x,y) in the GridCoverage2D raster and not in the matrix
> but shouldn't they be the same since i use the matrix to make the coverage?
>
> I hope you can help me solve my problem since i will use it both to point
> out the obstacles and the "game area".
>
> Regards
> Rasmus
>
> 
> View this message in context: http://osgeoorg.1803224.n2.nabble.com/Problemwithconvertingbetweencoordinatesandmatrixindextp6994581p6994581.html
> Sent from the geotoolsgt2users mailing list archive at Nabble.com.
>
> 
> RSA(R) Conference 2012
> Save $700 by Nov 18
> Register now
> http://p.sf.net/sfu/rsasfdev2dev1
> _______________________________________________
> Geotoolsgt2users mailing list
> Geotoolsgt2users@...
> https://lists.sourceforge.net/lists/listinfo/geotoolsgt2users
>
