Tag Info

Hot answers tagged

5

Reading Rasters by block can be done in rasterio and I'd argue it's easier than in GDAL. There is even a tutorial on windowed read/write over at GitHub. Let's take a look at the read functions arguments, which allows you to set a window to read data from: def read(self, indexes=None, out=None, window=None, masked=False, boundless=False): """Read ...


5

Step 1 Make bit rasters for each of the unique classes. This can be a 1-band rasters for each class, or a single raster with a band for each class (e.g. GeoTIFF). If using GTiff, you can use the creation option NBITS=1 to conserve space. You may also want to consider twobit rasters to store three-valued logic where the third (e.g. 2) is NODATA, which would ...


3

Try the IEEE 754 Converter http://www.h-schmidt.net/FloatConverter/IEEE754.html. Read the note: Rounding errors: Not every decimal number can be expressed exactly as a floating point number. This can be seen when entering "0.1" and examining its binary representation which is either slightly smaller or larger, depending on the last bit. You can ...


3

I found it, this dirty hack is not elegant at all but it works great, my command-line solution as follows: ogr2ogr -f CSV tmp.csv your.shp -lco GEOMETRY=AS_WKT -s_srs EPSG:4326 -t_srs EPSG:4326 -overwrite cat tmp.csv | sed -e '1,1d' | tr ',' '\n' | sed 's/[A-Za-z"()]*//g' | tr ' ' ',' | sed 's/^,//' > your.shp.csv One caveat, you just need to avoid ...


3

Use the ASCII to Raster tool. import arcpy arcpy.ASCIIToRaster_conversion("/path/to/file.asc", "/path/to/output.tif", "INTEGER") Note: A GeoTIFF is just a TIFF file with some extra metadata tags, and the only file extension that should be used for TIFFS in ArcGIS is .tif, not .tiff or .geotiff.


3

The dataset is getting dereferenced when you return only the band from your function. The solution is to return the dataset from your function. From the GDAL Python Gotchas page: Python crashes if you use an object after deleting an object it has a relationship with Consider this example: from osgeo import gdal dataset = ...


2

It's possible to do this conversion with gdalwarp(i think), but it would be way easier to do it using cs2cs cat ~/Desktop/coords.csv| sed 's/,/ /' | cs2cs +init=epsg:26912 +to +init=epsg:4326 -f '%.6f'


2

Draw the area(s) you want to hide from the image and save as vectors into shapefile or other format if you prefer. Then use the gdal_rasterize utility http://www.gdal.org/gdal_rasterize.html which burns fixed, non-transparent pixels into your image and removes permanently image data below the polygons. Here is an example. The map is a RGB tiff image with ...


2

self.coordTransform = self.coordinateTransformation(4326,3309) It looks like you have your source and destination coordinate systems mixed up.


2

I know it's been 5 months since this question was posted, but I thought I'd add in my $.02. I, too, had the problem of ogr2ogr not being able to connect. In my case, it turned out that ogr2ogr expects the mysql.sock file to be in /tmp/. If you're running MAMP, your sock file is actually located in /Applications/MAMP/tmp/mysql/mysql.sock. Creating a ...


2

I'm not sure what NOAA thinks are the right coordinates, but I have no problem loading the file into QGIS, or reprojecting it to WGS84 with gdalwarp: QGIS uses this custom projection string: +proj=lcc +lat_1=25 +lat_2=25 +lat_0=25 +lon_0=265 +x_0=0 +y_0=0 +a=6371229 +b=6371229 +units=m +no_defs You can use the same string with pyproj.Proj(). where you ...


2

I guess you have to swap the coordinates. It should be longitude latitude order. 45°E is not within UTM 32N (and within the extent of your source file), but 10°E will be. Apart from that, the manpage says: -te xmin ymin xmax ymax: set georeferenced extents of output file to be created (in target SRS by default, or in the SRS specified with -te_srs) ...


2

You can set the GDAL_MERGE process up with QGIS using the GUI and that might be a good way to start testing. Also, test on two tiles that are next to each other first. I reckon it's something to do with NODATA. Please post your command in your question so that we can see how you're achieving the merge.


2

I believe you can to it with one ogr2ogr command. The following solution should work for all sort of geometries and therefore I tested it with a two-part multipolygon, one of the parts having a hole. Background: With -dialect SQLite GDAL tools can utilize all the SQL functions of Spatialite https://www.gaia-gis.it/gaia-sins/spatialite-sql-latest.html. ...


1

It appears that pstoedit is your best bet: http://www.pstoedit.net/pstoedit/ Based on similar question: How to Import SVG into GIS?


1

Try something like that, where dx,dy are number of indexes: from osgeo import gdal file = gdal.Open( ’file.tif ’) def pixel(dx,dy): px = file.GetGeoTransform()[0] py = file.GetGeoTransform()[3] rx = file.GetGeoTransform()[1] ry = file.GetGeoTransform()[5] x = dx/rx + px y = dy/ry + py return x,y GetGeoTransform() function ...


1

Use gdal_polygonize.py, ogr2ogr and ogrinfo in a loop. On linux (not tested): final=merged.shp for f in *.tif; do name=$(basename $f .tif) shp=${name}.shp gdal_polygonize.py $f -f "ESRI Shapefile" $shp ogrinfo $shp -sql "ALTER TABLE $name ADD COLUMN name character(30)" ogrinfo $shp -sql "UPDATE $name SET name='$name'" if [ -f $final ...


1

Finally I managed to run ecw plugin inside geoserver version 2.7.2 Downloaded libecw source from http://meuk.technokrat.nl/libecwj2-3.3-2006-09-06.zip Applied this patch https://github.com/makinacorpus/libecw/blob/master/Source/C/NCSUtil/NCSPrefsXML.cpp.rej Ran ./configure, make and sudo make install commands to build. Override generated libs over ...


1

Openlayers and leaflet usually render tiles in World Mercator EPSG:3857. So you have to reproject your source file into that projection using gdalwarp, then start the tiling.


1

You can get GDAL 1.10 from http://download.osgeo.org/gdal/1.10.1/ and compile it the same way as you did with 1.9. BTW, GDAL 1.11.2 is the current stable version, and installing QGIS on a vanilla lubuntu 15.04 includes that GDAL version. So if you remove (delete the self-compilation and sudo apt-get purge the packages) all GDAL and QGIS stuff, then ...


1

NAD83(CSRS) (which is based on ITRF96(1997.0)) is not a simple transformation away from WGS84. It's anchored to the North American plate, which is rotating counter-clockwise, and uplifting -- in some places rapidly -- due to isostatic rebound. Proj doesn't know anything about this. It can transform from geographic to geocentric and UTM, and it can shift from ...


1

You were are actually converting from EPSG:4917 (ITRF96), not EPSG:4326 (WGS84). See the TRX online utility from NRCan to do this conversion: Unfortunately you cannot use PROJ.4 to convert ITRF projections; see enhancement ticket #154. If you were using WGS84 in place of ITRF96, then your steps with pyproj were fine. However, if you need ITRF96, then ...


1

As @StevenKay mentioned, quotes on the GeoJSON should be escaped with preceding backslash. pgsql2shp -f tiles.shp -h <host> -u <user> -P <pass> <database> "SELECT id, the_geom FROM <table> WHERE ST_GeomFromGeoJSON('{ \"type\": \"Polygon\", \"coordinates\": [ [ [ -92.472398018272358, 18.086381878379395 ], [ -92.472398018272358, ...


1

Just worked out how to do this with gdal_calc.py - to get around issues with files with different dimensions (and resolutions) you can use a VRT. gdalbuildvrt -separate combined.vrt dem1.tif dem2.tif gdal_calc.py -A combined.vrt -A_band=1 -B combined.vrt -B_band=2 --calc="A-B" --outfile diff.tif


1

Have a look at VTBuilder, found here: http://vterrain.org/Doc/VTBuilder/overview.html One of the supported formats is now ESRI ADF.


1

Image Boundary plugin did not work for me either, therefore I used the same approach with GDAL. Nevertheless it only worked for me after changing the first step to: step 1: gdalwarp -srcnodata 0 -dstalpah -of GTiff foo1 foo2 I am working with Landsat8 band (where no data=0) and when using the -dstnodata function I get: band1 with no data = 'no data' ...



Only top voted, non community-wiki answers of a minimum length are eligible