Using Proj.4/GDAL to convert lat,lon to i,j

المشرف العام

Administrator
طاقم الإدارة
I'm working with a data set in GRIB2 format and need to determine the grid cell index (i, j) corresponding to a given lat,lon. I have the projection definition in the form of projparams as follows:

{'a': 6371229, 'b': 6371229, 'lat_0': 25.0, 'lat_1': 25.0, 'lat_2': 25.0, 'lon_0': 265.0, 'proj': 'lcc'}which gives me the following srs:+units=m +a=6371229 +b=6371229 +lon_0=265.0 +proj=lcc +lat_2=25.0 +lat_1=25.0 +lat_0=25.0

And I know dx, dy, number of grid points in each direction etc.

So I was thinking of using Proj.4 (because it has JavaScript bindings) (and/or GDAL) to convert it to i,j. I think I have read somewhere that one could do it this way by defining some kind of equidistant metric map projection that would use i, j as x, y coordinates and do a simple coordinate transformation, but I'm struggling with how to actually define such a projection in proj.4 terms. Any help would be appreciated.



أكثر...
 
أعلى