New answers tagged

1

I got the same error message which was caused by me handing over a numpy matrix (not an array) to np.unique. You can make sure that a (multi-dimensional) array is passed by writing print np.unique(np.array(outArr))


1

You might get unexpected results because your dataset crosses the 180° meridian. As a consequence, the tile is squeezed around the globe when reprojected to WGS84. To avoid that, you have to cut the raster data at the +/- 179.99° meridian. The following batch works with pure GDAL: gdal_translate ...


-1

This is not an answer, I actually want to ask Luke a question, but i dont have 50 rep so i am unable to comment :( Luke, how would i get all 3 of the RGB values, I notice that the code above only grabs a single one, ive tried setting the buf_type=gdal.GDT_UInt16, to buf_type=gdal.GDT_UInt32 intval = struct.unpack('h' , structval) to intval = ...


3

Here's a basic example using rasterio and numpy: import rasterio as rio import numpy as np with rio.open('~/rasterio/tests/data/rgb1.tif') as src: # Read the raster into a (rows, cols, depth) array, # dstack this into a (depth, rows, cols) array, # the sum along the last axis (~= grayscale) grey = np.mean(np.dstack(src.read()), axis=2) ...


1

If you want GDAL you can use this (I found this code in another post and it works nice): rs = r'path\to\your\raster' def get_point_values(rs): src_shp = r'path\to\your\shape.shp' src_ds=gdal.Open(rs) gt=src_ds.GetGeoTransform() rb=src_ds.GetRasterBand(1) ds=ogr.Open(src_shp) lyr=ds.GetLayer() for feat in lyr: geom = ...


1

This is quite a nasty problem and hard to resolve without experience on different ways to store geodata into SQLite database. The problem is not in the output format but in the input format. The natural_earth_vector.sqlite database is written as FDO. Read more info from the "Regular" SQLite databases" section in the GDAL SQLite driver manual page ...


3

There is a python module called rasterstats that does compute zonal statistics. For each Polygon, your fields, there will be the underlying rastercells accumulated by SUM, MEAN, MIN or MAX. You find more infos and examples here: https://github.com/perrygeo/python-rasterstats Otherwise you find an example without this module here: ...


0

I report the respective Qgis code: gdal_polygonize.bat E:\Sviluppo\features_extraction\test\AIRONE_FPL_NoFlyZone_16bit.tif -f "ESRI Shapefile" E:/Sviluppo/features_extraction/test/output_v2.shp output_v2 it works succesfully. the gdal_polygonize.bat code is: @python "%OSGEO4W_ROOT%\bin\gdal_polygonize.py" %* It may be that i miss some parameters?


0

My only solution to getting MrSID working with geoserver was to uninstall the OpenGeo suite and install geoserver 2.8.3 directly. Then following the above steps worked as expected. OpenGeo suite appears to only support MrSID in its Enterprise version: http://suite.opengeo.org/docs/latest/dataadmin/mrsid/index.html


2

You can either leave the -s_srs empty or use +proj=sinu +R=6371007.181 +nadgrids=@null +wktext gdalwarp -of GTIFF -s_srs '+proj=sinu +R=6371007.181 +nadgrids=@null +wktext' -r cubic -t_srs '+proj=longlat +datum=WGS84 +no_defs' {inputfile} {outputfile} Note that inputfile must be the full subdataset (SDS) name, which you can get from gdalinfo. For example, ...


3

If all you need to do is move the origin of your raster slightly, i.e shift the pixels, you can use the Shift tool in ArcGIS Summary Moves (slides) the raster to a new geographic location, based on x and y shift values. This tool is helpful if your raster dataset needs to be shifted to align with another data file. Illustration


0

To find the batch_gdal_translate function, a solution is to use the SOS package directly in R/RSudio to find it. library(sos) unique( findFn("batch_gdal_translate")$Package ) found 2 matches Downloaded 2 links in 1 packages. [1] "gdalUtils" If you use directly findFn("batch_gdal_translate") You go directly to batch_gdal_translate {gdalUtils} from the ...


2

You are getting a return value of 1 - which means an error of some sort. Try using subprocess.check_output or subprocess.check_call so you get an exception raised if the command fails, you'll get a bit more about why it fails if you do this. A couple of possible problems: You are not passing the filepaths, you are passing the literal strings "inlist" ...


3

According to the GDAL Virtual Format Tutorial the equation used is: (DstMax - DstMin) * pow( (SrcValue - SrcMin) / (SrcMax - SrcMin), Exponent) + DstMin


4

You can download GDAL 2.1 for Windows from GIS Internals. There is an installer and a portable version that doesn't require installation. GDAL 2.1 is available for Ubuntu 16.04 from the UbuntuGIS-Unstable PPA sudo add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable sudo apt update sudo apt upgrade # if you already have gdal 1.11 installed sudo apt ...


0

I just happened to come across this question and a potential answer when looking for something else. gdal_merge.py uses nearest neighbor resampling. If you want control over the resampling used, you should use gdalwarp instead. source: trac.osgeo.org


1

Summarizing the comments so this question can be marked as answered: VRT does not support any kind of indexing. There is an open GDAL ticket about this http://trac.osgeo.org/gdal/ticket/5762. However, there may be a workaround. It should be possible to create a set of smaller .VRT files which contain a reasonable amount of images and then build another vrt ...


4

Your assumption is right, you need the correct values for the corner coordinates. Since the source image is slightly larger than the Earth, you can not simply reproject the corner coordinates. You may use a different approach: According to the project site, the 5500x5500pix data is providing a 2km resolution on the center. So the extent from the center is ...


1

Warp to reduce the resolution. Went from 674MB to 36MB. gdal_warp


3

The Gohlke GDAL/OGR wheel includes the FileGDB driver compiled as a plugin. To get the FileGDB driver working: Copy the Esri bin64\FileGDB.dll to [python install/virtualenv dir]\Lib\site-packages\osgeo (use bin\FileGDB.dll if using 32bit python). Do not copy the FileGDB.dll to the gdalplugins directory. Set GDAL_DRIVER_PATH environment variable, ...


3

The key information is here: I am also able to get OGR formats: ogrinfo --formats prints a bunch of them in the Windows cmd (with no FileGDB there though). This tells me that your GDAL_DRIVER_PATH environment variable is not set. See the instructions at https://trac.osgeo.org/gdal/wiki/FileGDB#Testingthedriver. Once "FileGDB" shows in ogrinfo --formats ...


1

I found a solution to my problem: Running a batch that temporarily sets the PATH variable to the GDAL-package and afterwards running a second batch that sets the rest of the variables needed by ogr2ogr and runs the ogr2ogr commands you need. The first batch looks like this: rem In this case the gdal package is located in C: setx PATH "C:\gdal;%PATH%" ...


0

Unfortunately, your test example is not online anymore, so I took a gobal Land-Sea-Temperature sample from ftp://landsaf.ipma.pt/pub/Example_of_Product/ As mentioned in my answer to Transforming geostationary satellite image to lon/lat, the size of global geos reprojected files is 3712x3712 pixels (3-km-resolution), but the actual data array is smaller. ...


-3

towercoverage.com makes it simple. You can upload your .csv of the sites, create radio systems to add to the sites, and run actual RF propagation maps. It also has easy website integration with APIs for end user sign up and pre-qualification. The android app makes antenna alignment and path analysis simple for field technicians. We have added 22 languages ...


1

Just to complete the answer from @Mattijn, I think that will lead into a problem if the input classes overlap with the output classes. I don't want my new value to be changed by the next rule. I don't know if I loose speed but I should do a deep copy : list_dest = lista.copy() list_dest[np.where( lista < 0 )] = 0 list_dest[np.where((0 <= lista) ...


2

Try with other zone it has no problem, I guess GDAL cannot wrap it outside. gdalwarp -t_srs '+proj=utm +zone=12 +datum=WGS84 +units=m +no_defs' test.tif test_utm1.tif


3

UPDATE: The above-mentioned approach by Oscar Perpiñán found here seems to work, if I only take a subset of the matrix the way Oscar did. For that to work I needed to know the subset boundaries and the static files, both available online for a few regions (such as North Africa). m = m[700:1850, 1240:3450, drop = FALSE] lon = raster("NAFR_LON.img") lat ...


7

Your attempt is designed to fail. If you look at the image, you see the data arranged as a circle, with black triangles in the corners of the square, where the satellite view goes right into orbit. In your test data, you see only NODATA -32768 for those parts of the image. The extent is between +/-75 and +/- 78, but these values are only reached in the ...


1

Im running into a similar issue. Using ArcGIS, I exported a TIFF, then in the OSGeo4W shell, I ran: gdalwarp -t_srs EPSG:3857 -of vrt mosaic1988bw.tif mosyonv.vrt gdal2tiles mosyonv.vrt 1988_bw_aerials It turned out that if my input raster is 16-bits, the tiles gdal2tiles produces suffer from digital noise as if Picaso cubed it up. However, if I ...


0

I had more versions of libsqlite3 due to my anaconda installation. Deleting anaconda dir from my path and re-running ./configure solved my problem.


2

The options value is a list, not a dict, and the elements are key value pairs. Try: co = ["HEADER=" + header_path, "TRAILER=" + trailer_path] dxf_ds = dxf_driver.CreateDataSource(dxf_out_path, options=co) I can't say dictionaries don't work, buy I don't recall seeing them in my experience. The python bindings closely follow the standard GDAL API.


1

This website lists out several options for you to consider... Learning GDAL and Open-source Tutorials GDAL.org OSGeo Trac Check out the options documented in this question, which address open source training in general.


3

There is no definitive way to determine the bands without vendor metadata. However, you can infer which bands are which by looking at a spectral profile of image reflectance values at features such as water and vegetation. For example, near infrared values in your imagery will be very low for water features and very high for healthy green vegetation. The red ...


0

It's not necessary to modify the projection, only the GeoTransform. In order to do this modification, it's necessary to know the new top-left corner of the data, and the new pixel spacing relative to the old one. First, save the current GeoTransform: current_gt=grib2_inst.GetGeoTransform() Work out the new pixel spacing. If you've interpolated your ...


3

libpq allows us to connect to Postgres/postgis for read write operations. If you have installed Postgres,libpq is already available.It would be available at installation path like C:\Program Files\PostgreSQL\9.5\include . //To make use in C/C++, you include these header files #include "libpq/libpq-fs.h" #include "libpq-fe.h" #include <stdlib.h> ...


0

I have found the problem with the GTiff driver. The problem is that I was not assigning a noDataValue to band2. There is a difference between the GTiff and the MEM drivers. When left unassigned, in the Gtiff driver assigns a nodatavalue for band2 to be equal to band1 noDataValue. However, the MEM driver does not. This inconsistency should be fixed. ...


0

@vink is correct. DGN is short form for 'design'.The file is used for storing CAD drawings. Most popular versions of DGN are v7 by Intergraph and v8 an improved version by Microstation.The internal format is described in dgnlib c/c++ library website.You may want to write your own parser looking at the format internals.If you want specifically in C# there is ...


1

As per @IvanSanchez' suggestion I'm going g to have web-ready 8-bit rasters with accompanying json metadata files. The metadata files have max and min values from the original 32-bit rasters which we use to interpolate the 0-255 values from the 8bit rasters so we can explore the values in real time.



Top 50 recent answers are included