[Gdal-dev] Re: Raster Soviet Topo Maps
Stephen Woodbridge
woodbri at swoodbridge.com
Mon Jan 1 15:48:18 EST 2007
Awesome Brent,
That fixed it. That was a stupid off by one calculation to generate the
epsg code. I also added an imagemagick convert command into the sequence
to convert the gif to a truecolor tif. For this sample of one the collar
gets nicely clipped except for a pixel border on the top and left edges
that I can probably live with.
Next I will batch process a bunch of images and see how they line up in
a tileindex. I probably also need to add -co TILED=YES to the last
gdalwarp and then also add some overviews.
woodbri at carto:~/work/collarclip$ ./collarclip -w -v -i
050k--h36-012-1.gif -d
Corner at: 74, 72
Corner at: 2858, 67
Corner at: 2865, 2259
Corner at: 74, 2266
convert tmp.gif -type TrueColor tmp.tif
getMapBBox: init=epsg:28406
bb->ul = (35.500000, 32.000000)
bb->ur = (35.750000, 32.000000)
bb->lr = (35.750000, 31.833333)
bb->ll = (35.500000, 31.833333)
projected as:
bb->pul = (6736269.9, 3544647.9)
bb->pur = (6759904.6, 3545222.1)
bb->plr = (6760374.1, 3526731.5)
bb->pll = (6736696.7, 3526158.9)
gdal_translate -gcp 74 72 6736269.9 3544647.9 -gcp 2858 67 6759904.6
3545222.1 -gcp 2865 2259 6760374.1 3526731.5 -gcp 74 2266 6736696.7
3526158.9 -a_srs EPSG:28406 tmp.tif tmp2.tif
Input file size is 2935, 2338
0...10...20...30...40...50...60...70...80...90...100 - done.
gdalwarp -rc -t_srs EPSG:28406 tmp2.tif tmp3.tif
Creating output file that is 2994P x 2392L.
:0...10...20...30...40...50...60...70...80...90...100 - done.
gdalwarp -rc -t_srs EPSG:4284 -te 35.50000000 31.83333333 35.75000000
32.00000000 tmp3.tif 050k--h36-012-1.tif
Creating output file that is 2966P x 1977L.
:0...10...20...30...40...50...60...70...80...90...100 - done.
Here is just the image coming through mapserver:
http://swoodbridge.com/cgi-bin/mapserv-4.10?scale=80000&mapxy=35.6250062+31.9166766&mapsize=1200+1200&mode=map&layers=all&map=/home/woodbri/public_html/tmp4.map
Here it is draped with hillshade generated from SRTM 90M DEMs:
http://swoodbridge.com/cgi-bin/mapserv-4.10?scale=60000&mapxy=35.6250062+31.9166766&mapsize=1200+1200&mode=map&layers=all&map=/home/woodbri/public_html/tmp5.map
gdal is very cool! Thanks Frank.
Thank you Brent for the help.
-Steve
Brent Fraser wrote:
> Steve,
>
> Some comments below:
>
>> gdal_translate -gcp 74 72 6736269.9 3544647.9 -gcp 2858 67 6759904.6
>> 3545222.1 -gcp 2865 2259 6760374.1 3526731.5 -gcp 74 2266 6736696.7
>> 3526158.9 -a_srs EPSG:28405 tmp.gif tmp2.tif
>> Input file size is 2935, 2338
>> 0...10...20...30...40...50...60...70...80...90...100 - done.
>
> The above (and below) SRS should be 28406....
>
>> # What is this command doing? or if I change the -t_srs EPSG:4285?
>>
>
> The following command WARPS the raster using the affine transformation:
>
>> gdalwarp -rc -t_srs EPSG:28405 tmp2.tif tmp3.tif
>> :0...10...20...30...40...50...60...70...80...90...100 - done.
>>
>> # Maybe I should be using this command INSTEAD of the command above? Is
>> # this command supposed to clip the collar also? In a prior email you
>> # mentioned it along with clipping the collar, and I thought it might be
>> # doing that also, or is the collar clipping done with another utility?
>>
> The following command PROJECTS the raster (and clips? I'm not sure that's
> possible):
>
>> gdalwarp -rc -t_srs EPSG:4284 -te 35.50000000 31.83333333 35.75000000
>> 32.00000000 tmp3.tif 050k--h36-012-1.tif
>> Creating output file that is 3078P x 2052L.
>> :0...10...20...30...40...50...60...70...80...90...100 - done.
>>
> Brent
>
More information about the Gdal-dev
mailing list