h4tr3d / geocrop

Small tool based on GDAL/PROJ4 to automatic crop box on GeoTIFF maps (in most cases - Russians).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Обрезается половина карты.

ghkadim opened this issue · comments

После обработки в QMapShark отображается правая половина исходной карты. Как я понимаю, неправильно обрабатываются карты содержащие две части. Например 500м Хибины Q-36-007-A,B.map.

geocrop -s 50k -f VRT Q-36-007-A,B.map Q-36-007-A,B.vrt
InDriver: MAP/0
InSize: 4096x4096x3
Projection: PROJCS["unnamed",GEOGCS["Pulkovo 1942",DATUM["Pulkovo_1942",SPHEROID["Krassowsky 1940",6378245,298.3,AUTHORITY["EPSG","7024"]],TOWGS84[23.92,-141.27,-80.9,-0,0.35,0.82,-0.12],AUTHORITY["EPSG","6284"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4284"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",33],PARAMETER["scale_factor",1],PARAMETER["false_easting",6500000],PARAMETER["false_northing",0],UNIT["Meter",1]]
Coordinate zero (6499975.462299,7547313.905286)
Pixel size (5.155014,-5.154346)
Shape center: ( 2048,  2048)
Shape center coordinates: (6510532.828739, 7536756.574927)
PROJ4: +proj=tmerc +lat_0=0 +lon_0=33 +k=1 +x_0=6500000 +y_0=0 +ellps=krass +towgs84=23.92,-141.27,-80.9,-0,0.35,0.82,-0.12 +units=m +no_defs 
PROJ4:  +proj=latlong +ellps=krass +towgs84=23.92,-141.27,-80.9,-0,0.35,0.82,-0.12
Shape center coordinates (alt/lon): (67.916811, 33.250948)
Shape of the 1M map: Q-36
Shape border coordinates (lat/lon) Q-36:
   (68.000000, 30.000000)   (68.000000, 36.000000)
   (64.000000, 30.000000)   (64.000000, 36.000000)
tmpx = 6, tmpy = 0
Shape number: Q-36-007-B
Shape border coordinates (lat/lon) Q-36-007-B:
   (68.000000, 33.250000)   (68.000000, 33.500000)
   (67.833333, 33.250000)   (67.833333, 33.500000)
Shape border coordinates Q-36-007-B:
   (6510455.531201, 7546034.993809)   (6520910.919236, 7546098.442264)
   (6510530.692215, 7527445.715481)   (6521061.241048, 7527509.544674)
Shape border in pixels Q-36-007-B:
   ( 2032,   247)   ( 4061,   235)
   ( 2047,  3854)   ( 4090,  3841)
/tmp/geocrop.zAu6LU.csv
Polygon:
POLYGON((6.51046e+06 7.54603e+06,6.52091e+06 7.5461e+06,6.52106e+06 7.52751e+06,6.51053e+06 7.52745e+06))
gdalwarp args:
   gdalwarp
   -of
   VRT
   -dstalpha
   -cutline
   /tmp/geocrop.zAu6LU.csv
   -crop_to_cutline
   Q-36-007-A,B.map
   Q-36-007-A,B.vrt
Creating output file that is 2056P x 3618L.
Processing input file Q-36-007-A,B.map.
Warning : the source raster dataset has a SRS, but the cutline features
not.  We assume that the cutline coordinates are expressed in the destination SRS.
If not, cutline results may be incorrect.

2км Хибины так же:

geocrop -s 200k -f VRT Q-36-05,06.map Q-36-05,06.vrt
InDriver: MAP/0
InSize: 4096x4096x3
Projection: PROJCS["unnamed",GEOGCS["Pulkovo 1942",DATUM["Pulkovo_1942",SPHEROID["Krassowsky 1940",6378245,298.3,AUTHORITY["EPSG","7024"]],TOWGS84[23.92,-141.27,-80.9,-0,0.35,0.82,-0.12],AUTHORITY["EPSG","6284"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4284"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",33],PARAMETER["scale_factor",1],PARAMETER["false_easting",6500000],PARAMETER["false_northing",0],UNIT["Meter",1]]
Coordinate zero (6541716.844823,7554226.399534)
Pixel size (21.342625,-21.339544)
Shape center: ( 2048,  2048)
Shape center coordinates: (6585425.060599, 7510522.794223)
PROJ4: +proj=tmerc +lat_0=0 +lon_0=33 +k=1 +x_0=6500000 +y_0=0 +ellps=krass +towgs84=23.92,-141.27,-80.9,-0,0.35,0.82,-0.12 +units=m +no_defs 
PROJ4:  +proj=latlong +ellps=krass +towgs84=23.92,-141.27,-80.9,-0,0.35,0.82,-0.12
Shape center coordinates (alt/lon): (67.669341, 35.014166)
Shape of the 1M map: Q-36
Shape border coordinates (lat/lon) Q-36:
   (68.000000, 30.000000)   (68.000000, 36.000000)
   (64.000000, 30.000000)   (64.000000, 36.000000)
tmpx = 5, tmpy = 0
Shape number: Q-36-06
Shape border coordinates (lat/lon) Q-36-06:
   (68.000000, 35.000000)   (68.000000, 36.000000)
   (67.333333, 35.000000)   (67.333333, 36.000000)
Shape border coordinates Q-36-06:
   (6583632.222389, 7547367.391437)   (6625425.418790, 7549059.264475)
   (6586032.943797, 7473044.285990)   (6629026.378991, 7474776.448253)
Shape border in pixels Q-36-06:
   ( 1963,   321)   ( 3922,   242)
   ( 2076,  3804)   ( 4090,  3723)
/tmp/geocrop.1YwQz5.csv
Polygon:
POLYGON((6.58363e+06 7.54737e+06,6.62543e+06 7.54906e+06,6.62903e+06 7.47478e+06,6.58603e+06 7.47304e+06))
gdalwarp args:
   gdalwarp
   -of
   VRT
   -dstalpha
   -cutline
   /tmp/geocrop.1YwQz5.csv
   -crop_to_cutline
   Q-36-05,06.map
   Q-36-05,06.vrt
Creating output file that is 2127P x 3562L.
Processing input file Q-36-05,06.map.
Warning : the source raster dataset has a SRS, but the cutline features
not.  We assume that the cutline coordinates are expressed in the destination SRS.
If not, cutline results may be incorrect.

Отдельный алгоритм для сдвоенных листов северных районов не делался: пока потребности не было. Можешь выложить проблемные листы? Попробую в ближайшее время придумать решение.

Проверь. Сейчас в логах будет несколько некорректный вывод номенклатуры листа, но на насчёт это никак влиять не должно: просто для высоких широт ввёл множитель 1, 2 или 4 листов по долготе. Естественно, это несколько поломало расчёт номера зоны :) Появится время, исправлю.

Спасибо, 500м работает. А вот 2км обрезаются до листа размером с 500м. Пример карты лежит там же.

Стоп, а параметр масштаба с 50k на 200k исправил? :) У меня эта карта нормально обрезалась.

Да, масштаб забыл. Спасибо!