[gdal-dev] Clip tiff with shapefile
Even Rouault
even.rouault at spatialys.com
Mon Jun 12 10:48:16 PDT 2017
On lundi 12 juin 2017 16:14:21 CEST Paul Meems wrote:
> Hi,
>
> I'm trying to clip a tiff-file with a shapefile.
> I'm using GDAL v2.1.3 with the SWIG-bindings in my C# application.
>
> The tiff-file has this info:
> Driver: GTiff/GeoTIFF
> Files:
> Size is 5140, 6065
> Coordinate System is:
> PROJCS["WGS 84 / UTM zone 32N",
> GEOGCS["WGS 84",
> DATUM["WGS_1984",
> SPHEROID["WGS 84",6378137,298.257223563,
> AUTHORITY["EPSG","7030"]],
> AUTHORITY["EPSG","6326"]],
> PRIMEM["Greenwich",0,
> AUTHORITY["EPSG","8901"]],
> UNIT["degree",0.0174532925199433,
> AUTHORITY["EPSG","9122"]],
> AUTHORITY["EPSG","4326"]],
> PROJECTION["Transverse_Mercator"],
> PARAMETER["latitude_of_origin",0],
> PARAMETER["central_meridian",9],
> PARAMETER["scale_factor",0.9996],
> PARAMETER["false_easting",500000],
> PARAMETER["false_northing",0],
> UNIT["metre",1,
> AUTHORITY["EPSG","9001"]],
> AXIS["Easting",EAST],
> AXIS["Northing",NORTH],
> AUTHORITY["EPSG","32632"]]
> Origin = (360810.191610000040000,5860662.620930000200000)
> Pixel Size = (0.125010000000000,-0.125010000000000)
> Metadata:
> AREA_OR_POINT=Area
> TIFFTAG_SOFTWARE=pix4dmapper
> Image Structure Metadata:
> COMPRESSION=LZW
> INTERLEAVE=BAND
> Corner Coordinates:
> Upper Left ( 360810.192, 5860662.621) ( 6d55'54.04"E, 52d52'39.50"N)
> Lower Left ( 360810.192, 5859904.435) ( 6d55'55.21"E, 52d52'14.98"N)
> Upper Right ( 361452.743, 5860662.621) ( 6d56'28.39"E, 52d52'40.10"N)
> Lower Right ( 361452.743, 5859904.435) ( 6d56'29.55"E, 52d52'15.58"N)
> Center ( 361131.467, 5860283.528) ( 6d56'11.80"E, 52d52'27.54"N)
> Band 1 Block=256x256 Type=Float32, ColorInterp=Gray
> Min=-0.177 Max=33.644
> Minimum=-0.177, Maximum=33.644, Mean=18.605, StdDev=7.894
> NoData Value=-10000
> Metadata:
> STATISTICS_MAXIMUM=33.644180297852
> STATISTICS_MEAN=18.604999564386
> STATISTICS_MINIMUM=-0.17713606357574
> STATISTICS_STDDEV=7.8939827089249
>
> The border can be in a different projection. Because I create this file
> earlier I know its EPSG-code.
> Before clipping I want to check if both files are in the same projection.
> How can I do this? I know I can use SpatialReference. But how to convert
> the projection string in the metadata of my tiff to EPSG code?
You don't necessarily need to do that. As a value of -s_srs / -t_srs you can pass a WKT string
(or a proj.4 string)
To answer your question if you use the SpatialReference.GetAuthorityCode(), you will get the
EPSG code (when there's one explicitly set in the projection string)
Even
--
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20170612/f628d692/attachment.html>
More information about the gdal-dev
mailing list