Tag Info

New answers tagged

1

Sorry, I can't replicate your problem. I have a 2048x1024px image of Blue Marble referenced to WGS84, and warped it in GDAL with gdalwarp -t_srs "+proj=sinu" bluemarble-WGS84.tif bluemarble-sinu.tif and get:


0

Maybe can you try ogr2ogr -clipdst DATASOURCE destinationFile sourceFile. For example : ogr2ogr-clipdst yourPolygon.shp destinationFile yourPolylines.shp. But, in this case, you will cut one shapefile with another. If you want to cut your polylines shapefile with each features of a polygon shapefile, you must split the polygon shapefile and iterate over ...


2

After following a subset of this advice, this is how I got the Python GDAL 1.11.0 install to work on Ubuntu 14.04 with pip: Install dependencies: sudo apt-get install libgdal-dev libgdal1h Pip install and pass along the include path: sudo pip install --global-option=build_ext --global-option="-I/usr/include/gdal" gdal


0

Maybe, try again by exporting variable as mentioned at this other question. Yes, your virtualenv will be polluted following recipes in the above link answers but didn't find better...


0

For read access the easiest way to get ECW support is through the OSGeo4W installer. Do an Advanced install, and in the libs section enable the gdal-ecw library.


1

You cannot only unzip the folder, you must install the module with python setup.py installbut osgeo is a Python wrapper of the GDAL C++ library. Therefore you need to install first the GDAL library and then install the Python module witch uses the GDAL libraries Dependencies: * libgdal (1.11.0 or greater) and header files (gdal-devel) You can compile ...


0

Did you try Envoy library, a wrapper on top of Python subprocess? It could help skip the issue. To launch commands 1 and 2 import envoy cmd1 = ['gdalwarp', '-t_srs','+proj=longlat +ellps=WGS84','*.tif','new7.tif'] cmd2 = ['gdalwarp', '-t_srs','+proj=longlat +ellps=WGS84','newfolder/band4.tif','newfolder/band4_r.tif'] r1 = envoy.run(' '.join(cmd1)) r2 = ...


2

Your code is wrong. Do this: from osgeo import gdal GDAL is a module of the osgeo package. You don't ever import osgeo itself. In Python a package is a convenient collection of modules and provides a 'name-space' for that collection. So, you can drill down further and import specific functions or variables from a module within a package like this: ...


-1

You can download the updated gdal2tiles.py for Google/OSM tiles by link http://gisfile.com/user/admin/gdal2tiles.py


1

All four of the databases you listed have the capability to support the type of query you're asking about. SQLite and Postgres through extensions (Spatialite & PostGIS respectively), mySQL and MariaDB have some basic GIS support built in natively. As to which to use, it depends on your needs. Personally I go with SQLite for simple in house ...


0

The easiest way to do this is by importing the path where gdal_merge.py is located, in my case, /usr/bin/ -- substitute with the path to gdal_merge on your system, which, obviously, could be a Windows path too. import sys sys.path.append('/usr/bin/') import gdal_merge as gm You will now have to build up an array for sys.argv, as if you were calling ...


1

I did a little more digging and found the answer to my question: instead of using os.system, the correct syntax for storing the result in a variable is: result = os.popen('gdallocationinfo -valonly -wgs84 %s %s' % (lyr, loc)).read()


1

I think you will have to use the subprocess syntax, it is explained in this post: subprocess to call gdal from within python


1

You could create a GDALDataset with as many bands as you have raster bands, then copy the data from each of your bands into the corresponding band in the GDALDataset. Here's some example code in C++ (since that's where I'm most familiar with GDAL). //create the dataset const char *filename = "example.tif"; GDALDriver *pDriverTiff = ...


0

You can use the gdalwarp utility (http://www.gdal.org/gdalwarp.html) to subset an image, the command would be something like: gdalwarp -te tilexmin tileymin tilexmax tileymax \ -t_srs targetproj.wkt \ -of GTiff \ bigmosaic.tiff smalltile.tif Where 'targetproj.wkt' is a well known text file file containing the output projection (this can be the same as ...


1

The global 50 m mosaics available to download from http://www.eorc.jaxa.jp/ALOS/en/palsar_fnf/fnf_index.htm are mapped binary files with an ENVI header. You should just be able to read them using GDAL with the ENVI driver (I've not had any problems doing this). You need to apply the following equation to calibrate HH and HV data to gamma0 gamma0 = ...


4

Reorganise your shapefile so that one shapefile contains one feature (A,B,C in your case) only Then use a loop like for i in A B C; do gdalwarp -cutline $i.shp ... $i.tif done to create each output raster. Example of script: #!/bin/sh # "shp" - folder for shapefiles # "outputraster" - folder for output rasters cd /home/user/cliprasters/ # ...


2

If you don't know the extent in coordinates of the prj file, you have to georeference the file manually using ground control points. This is rather comfortable if you have QGIS installed, and you can guess some details from the image. In some cases, you can build the extent manually if the filename follows a certain rule, like the one-degree-SRTM files do. ...


1

to accomplish what your code is doing, # reclassify raster values equal 16 to 7 using Numpy temp = numpy.equal(raster, 16) numpy.putmask(raster, temp, 7) another, perhaps more intuitive way is: # reclassify raster values equal 16 to 7 using Numpy temp = raster == 16 #gives you a numpy array of bools with same shape raster[temp] = 7 #or a short cut ...


0

you can use batch hegtool, read this: http://newsroom.gsfc.nasa.gov/sdptoolkit/HEG/HEGFAQ_CLI.html and this: http://newsroom.gsfc.nasa.gov/sdptoolkit/HEG/HEG_Batch_job_Help.htm


1

In the end I wrote the following script that solved my problem. The script converts raster pixels with a specified value to vector lines. For example the blue pixels (value = 0) are converted to vector lines. There is definitly room to improve the script, as you can see in the result image. The script can be found and edited here. Raster Image Raster ...


2

It's highly inefficient to merge mosaic using gdal merge. Instead, make a VRT (Virtual Dataset) and convert it to your favourite format.


2

Here is an example that does roughly what you ask for. The main parameters are the geotransform array that gdal uses to describe a raster location (position, pixel scale, and skew) and the epsg code of the projection. With that, the following code should properly georeference the raster and specify its projection. I did not test this much, but it seemed to ...


1

Assuming you have saved the output of your GCP points, can you compare the values in this file with the auto-generated script? I've noticed that the script rounds values; I wonder if this could be introducing a source of error.


5

Install Raspbian: Download NOOBS Follow the NOOBS Setup instructions. Update Raspbian from its Debian wheezy base to Debian jessie: sudo vi /etc/apt/sources.list # or use your favourite editor change all references of wheezy to jessie sudo apt-get update sudo apt-get upgrade # this will take a long time, with occasional user prompts sudo apt-get ...


0

1) Looks good, but you can crop, warp and convert data into XYZ with a single command by addind parameter -of XYZ to your gdalwarp command. However, some file formats are not good targets for gdalwarp which must append data to initialized target while the warping process is progressing. Make a trial and test if using tiff as on interim format is faster or ...


1

Looks like GDAL and QGIS are part of the Raspbian Repository. So check that your /etc/apt/sources.list file is configured, then try: sudo apt-get update sudo apt-get install gdal-bin qgis I don't have a RPi, so I can't check if it works. You can try virtualise Raspbian with QEMU, so you can check it out yourself before making a large investment.


3

gdal_merge.py -o output.tif `ls *.tif` The back ticks mean execute whatever is inside the back ticks before the main command, so this will find all tif files in current directory, which will then be used as the input to gdal_merge.py. Instead of backticks, you can also use the $(command) syntax, ie, gdal_merge.py -o output.tif $(ls *.tif) is ...


1

In OGR, the elevation data gets stored in a point layer called track_points. You can do "normal" ogr2ogr operations preserving the elevation data like this: ogr2ogr -f GPX output.gpx input.gpx waypoints routes track_points However, that fails on your ST_UNION command because you requested a Multilinestring (which has no vertex elevation data by ...


0

Apparently, I am not specifying the gdal parameters correctly. After getting bitten by this almost 2 years later in a different manner, kwbeam answered a question regarding horizontal artifacts in gdal which applies directly to this question as well. The short answer is that you have to make the error tolerance very small in the gdalwarp command. I ...


0

Ok, I'm still fuzzy on what exactly your export file is but I'll assume "#of cells" is simply the number of pixes for each raster and "Value" is some identifier for each raster (parse the file name??). In absence of how to get "Value", I just put an incremented variable. This script will require gdal. import glob from osgeo import gdal import numpy as np ...


0

if you want to convert to geotiff with raster package: input_name=raster("c:/file.bil") #if you use output_name="c:/output.tif") writeRaster(input_name, output_name,format="GTiff",datatype='INT1U',overwrite=TRUE) the data type depends of your input data type, in this case 8bits. if you want to convert to geotiff with gdalUtils package: ...


0

DGNLib is a small C/C++ library.


2

Try adding the -et (error threshold) option with lower thresholds than the default (0.125). When I use "-et 0.01", the horizontal artifacts disappear: gdalwarp -t_srs "+proj=stere +lat_0=90 +lon_0=-45 +lat_ts=70 +ellps=WGS84 +datum=WGS84 +units=m" \ -et 0.01 \ ./UiMbqSd.withmetadata.tif ./regridded_lon0_-45.tif


0

Try changing the resampling method for gdalwarp, e.g. gdalwarp -r mode etc. etc. which seems to remove your problem. What makes most sense will be different for different data.


2

Yes another way exists. Just use gdal_calc.py For example, below will convert the values below 3 to 0 and above 3 to 1. You can use equals as well. gdal_calc.py -A C:temp\raster.tif --outfile=result.tiff --calc="0*(A<3)" --calc="1*(A>3)"


0

Here is a solution as windows batch script, maybe it'll help: set in_path=path_to_stored_hdfs set out_path=path_to_proccessed_ones md %out_path% cd /d %in_path% FORFILES /m *L2_LAC*.hdf /C "cmd /c gdalwarp -geoloc -t_srs EPSG:4326 -te 113.205 1.120 157.105 2.005 HDF4_SDS:hdf:@file:01 %out_path%\@fname.tif" Where /m is a mask to match desired filenames ...


0

Since you have not specified any path, Python will put your file in the same directory as the Python EXE. This is not good practice. It is much better to specify a known path. You could maybe pick that up from some environment variable to make it relative to the project or hard code a proper path into your python e.g.: ...


1

GDAL is deeply inside a library but there are many command line tools for vector and raster processing which can be considered to be a part of GDAL. See raster and vector utility programs from http://gdal.org/. However, GDAL is used in large number of programs which may offer graphival user interface to GDAL ...


0

To answer the virtualenv specific aspect of the question: pip3 search gdal GDAL - GDAL: Geospatial Data Abstraction Library pygdal - Virtualenv and setuptools friendly version of standard GDAL python bindings Beware that pygdal may require a different version of GDAL, compared to what ...


3

Although it would require another library (which currently is only available on OS X and Linux) you could use RSGISLib (http://rsgislib.org), which is built on top of GDAL to do this. There is a function to stack bands, as an example: #!/usr/bin/env python import rsgislib from rsgislib import imageutils # Create list of images imageList = ...


0

After looking right and left for a solution, here is something that works for me on Ubuntu 14.04, even from within a virtualenv with no access to the system packages : Install dependencies : sudo apt-get install libgdal-dev libgdal1h libgdal1-dev Set the compiler flags : export CFLAGS=$(gdal-config --cflags) Install the version corresponding to the ...


2

Turns out it is as easy as this: MIMETYPE "application/json; subtype=geojson; charset=utf-8" Without the setting, no content encoding is returned by the server.


0

I am not able to find some general solutions which would be CRS independent but for my case - axis in left bottom corner - the following changes works: Start from max_y and use minus value for y cell size: geotransform=(min_x,min_cell_size,0,max_y,0,-min_cell_size) Revert the array lines from bottom to top: zi = zi[::-1,:] Will be glad if somebody ...



Top 50 recent answers are included