Hot answers tagged geotiff
28
To select compression method you need to use a command like:
gdal_translate -co "COMPRESS=method" src_dataset dst_dataset
When you use compression biggest trade-off is extra processing time which is required to uncompress the image, and after uncompressing the image would still consume same amount of memory. About information loss there are two basic ...
20
Looks like gdalinfo will tell you:
A non-georeferenced figure exported from ArcMap layout:
C:\Temp>gdalinfo figure1.tif
Driver: GTiff/GeoTIFF
Files: figure1.tif
Size is 244, 210
Coordinate System is `'
Metadata:
TIFFTAG_XRESOLUTION=96
TIFFTAG_YRESOLUTION=96
TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
Image Structure Metadata:
INTERLEAVE=PIXEL
Corner ...
10
Usually, GeoTIFFs are compressed for storage. Running gdal_merge on default settings won't compress the file. Add the option
-co COMPRESS=DEFLATE
(or any of the other options listed in the documentation) to your command to get smaller output files.
10
You need to tile the image and add overviews so that the whole image is never read into memory at the same time. GeoServer provides an image pyramid datastore for this purpose.
I wrote these notes describing how I set this up on my machine. The key step is to use GDAL to build the pyramid using the following command:
mkdir bmpyramid
gdal_retile.py -v -r ...
9
Adding on to Chad's answer: Is there a .TFW file accompanying the TIF? If so, the image has georef info that isn't embedded in the header. I don't know if GDALINFO will catch that or not.
Unfortunately a TFW only gives you coordinates and cell sizes. It doesn't specify which CRS/projection/datum the image is referenced to, nor what units are used for the ...
8
Make a tiny Python script named "UpdateSRS.py":
import sys
from glob import glob
from osgeo import gdal, osr
# Define your projection here
sr = osr.SpatialReference()
# For example, UTM Zone 11
sr.SetUTM(11)
sr_wkt = sr.ExportToWkt()
file_list = set()
for arg in sys.argv[1:]:
file_list.update(glob(arg))
for file in file_list:
ds = gdal.Open(file, ...
7
I suspect that your TIFFs might be Ordnance Survey Vector Map District rasters? I've not loaded any of these into Postgres/PostGIS but I have loaded some into a Rasterlite DB. The secret is to batch translate the TIFFs from indexed to RGB GeoTIFFs before loading them into the database. Raster -> Conversion -> Translate (Convert Format), tick 'Batch mode' and ...
6
With lzw and deflate compression using -co predictor=2 can help with imagery that is smoothly varying as it compresses the differences from pixel to pixel instead of the absolute values, and these will tend to be small and have more patterns (ref). Predictor is only useful with lzw and deflate compression, the option has no effect with other methods.
...
6
In arcmap 10.
I think I would use the footprint feature (in mosaic dataset) and
then generate the centroid of those polygons.
add an x and a y field to my attribute table,
calculate the geometry,
then export to dbf and convert to xls.
Also found in this answer are several resources for esri help.
6
You need a Python library that supports the GeoTIFF format. Libraries that support only the TIFF file discard the projection and geotransform metadata when they are saved. GDAL is the most used open source Python library for reading/writing spatially aware rasters. So, for your example:
from osgeo import gdal
# Load file, and access the band and get a ...
6
Download the source code from here
http://www.osola.org.uk/elevations/index.htm
SRTMGeoTIFFReader.php is the clever file the reads the GeoTiff and converts the elevation values (in meters) into Lat/Lng coordinates.
I doubt this is exactly what you want but it does give you a solid base on understanding the process required to accomplish the task from your ...
6
There is a little bit of information which might help you in your task.
First you may need to download FWTools inorder to use geotifcp and listgeo.
Create a TIFF File(You already did it..) Let us call it initialtif.tif
find the image width and height(from where you saved it).
imageWidth = 1016
imageHeight = 551
Create a World File for our ...
6
I think that all of listed by you software allow to execute batch converting in some way.
ArcGIS
I can explain how is it possible to perform in ArcGIS.
Converting of one raster JPEG2000 -> GeoTiff can be done using tool Raster To Other Format (Conversion). Don't forget to setup appropriate raster storage settings in Environment variables when running ...
6
I am not sure if you are aware of the -scale feature of the gdaltranslate tool. it might be just what you are looking for. It defaults to 0-255 and the min and maxx of your rasters. You should also set the null values before using this.
You might want to specify the output as type Byte just to be sure
-ot "Byte"
hope this helps, :)
Edit: I always like ...
6
I have written a tutorial on exactly this problem that you may find helpful.
Basically it boils down to using gdal_translate, gdal_merge and gdal_retile so you will need to have installed GDAL. Either use apt-get install gdal or the osgeo4w installer
6
There is no service or readily available tool that I can think of. But if you are comfortable on the command line and willing to spend some time tinkering, here is a way that can work
download the OSM shapefile
import the shapefile to TileMill.
Once you style it, export it as a georeferenced PNG.
Use gdal_translate to convert it to a GeoTiff.
5
For big rasters GeoTiff offers the possibility to store (pre-)downscaled overviews as extra images to the GeoTiff file. This can be done with gdaladdo (= GDAL ADD Overview). When creating these overviews, you can manually tell gdal to comress them too:
gdaladdo --config COMPRESS_OVERVIEW JPEG
Speeds up viewing your data without adding too much size.
...
5
You can use the "-a_srs filename.prj" parameter with gdal_translate to accomplish this. From the documentation:
The srs_def may be any of the usual
GDAL/OGR forms, complete WKT, PROJ.4,
EPSG:n or a file containing the WKT.
(emphasis added)
5
I wrote a small gdal python script for this, gdalsetnull.py, a simple command line program to set specified raster value NODATA, without creating a new raster. The easiest route to installing GDAL on windows is via OSGeo4W. Examples:
python gdalsetnull.py foobar.tif 0 # pure black is transparent
python gdalsetnull.py foobar.tif 0 255 0 # ...
5
In concept, you need to figure out what pixel values represent cells with no data and then edit your color table to assign the RED,GREEN,BLUE (RGB) values in the color table to be 255,255,255 for that cell value.
If you don't have the appropriate license to do this in Arc, you could use the gdal_translate tool (one of the gdal/ogr commandline tools)
...
5
Here's an old blog article of mine looking at the file size and access time of the formats. I didn't investigate the write speed, only the access time. I'd say they would probably be directly related, but wouldn't be able to vouch for it.
Article Summary: It seems that Packbits gives you the best access times (at expense of disk space), whereas Deflate ...
5
I would say then that your best bet would be to use a WMS (something like MapServer or GeoServer, or their commercial equivalents), and serve your image data as tiles. It'll take a bit of setting up, but it would avoid having to load all the files just to see a small area at a time.
There are plenty of questions and good answers here about setting up a WMS, ...
5
Corrected two mistakes in the original code. I tested this and it works now.
Copy paste this into the python window in arcmap to create the RasterCenter function:
import arcpy, os
def RasterCenter(raster):
#raster: string reference to raster
raster = arcpy.Raster(raster)
center = arcpy.Point(raster.extent.XMin + (raster.extent.XMax - ...
5
GDAL has a wonderful file format called VRT, which is an XML wrapper around one or more raster files.
One feature of VRTs is their ability to encode square convolution kernels for any given band. It does involve playing around with XML in a text editor (or programatically), but if you're already used to the GDAL tools, it shouldn't be too hard.
To ...
5
The output Tiff is likely not using compression, hence the larger file size. Use the gdal_translate command, something along the lines of this:
gdal_translate -of GTiff -co "COMPRESS=DEFLATE" -b N fnp_braunschweig.tif fnp_bs.tif
where N is the band number you want to keep. The options for compression are NONE, LZW, PACKBITS, JPEG, CCITTRLE, CCITTFAX3, ...
5
You can use GetStatistics Method to get the stats.
eg.
stats = ds.GetRasterBand(1).GetStatistics(0,1)
it will return (Min, Max, Mean, StdDev)
so the xml can be read:
<PAMDataset>
<PAMRasterBand band="1">
<Metadata>
<MDI key="STATISTICS_MINIMUM">stats[0]</MDI>
<MDI ...
5
What you want to do is called Normalization and the general formula is :
where:
In = New Value
I = Present Value
Min= The minimum present value
Max = The maximum present value
newMin/newMax = the desired Min/Man (in your case 0 and 255)
You can use use a combination of gdal/python/numpy to open hdf datasets and perform cell calculations based on ...
5
You could explicitly set the output coordinate range using the target extent option to gdalwarp (ie. "-te -180 -90 180 90") but you can also use the CENTER_LONG configuration option to force rewrapping around a new central longitude. Something like this:
gdalwarp -t_srs WGS84 ~/0_360.tif 180.tif -wo SOURCE_EXTRA=1000 \
--config CENTER_LONG 0
...
5
I had a similar problem few weeks ago . I resolved it this way:
creating pyramids rasters image (all rasters had got pyramids
depends on standard scale rate in my project
creating tiles from raster (mosaic)
putting all files to postgis (by WKTRaster)
By this way you get MRDB (multi-resolution data base) which is the most effective way of serving a large ...
5
I ran an experiment with a TIFF file and an ECW. Started with a 1.2 GB ECW, and converted it to TIFF with compression and pyramids, it was ~1.5 GB. So I think that a TIFF can be a similar size to an ECW.
I would mosaic the image using GDAL, ensuring that compression is on. Then build pyramids, and if the resulting file is reasonable (less than 10 GB, I ...
Only top voted, non community-wiki answers of a minimum length are eligible
