Tag Info

New answers tagged

0

Just figured out a way to do this in R, inspired by the link I posted in the comments (which uses outdated functionalities but the right packages); as an example, I'll use the "Southwesternmost" counties in Michigan (shapefile here--Allegan, Berrien, Cass, Kalamazoo, St. Joseph, and Van Buren counties) So, ordering counties alphabetically, the (length>0, ...


0

I have ended up using Python with GDAL etc as it comes as easily installable and after that portable package when installing QGIS OSGeo4W. Matplotlib - matplotlib.mlab.griddata (interp='linear') for superfast interpolation into regular grid. On that can by applied matplotlib.pyplot.contour to very fast contouring. Package osgeo.ogr and shapely to save to GIS ...


1

Before you use this, please check out this link for a solid Vincenty example. Luckily, Javascript is very C-like so its not too hard to make it work for C++. Please also forgive any coding no-nos as this was thrown together rather quickly. My Datum is WGS84. I ran this through g++ and got a matching answer as their online calculator. I have never been ...


1

You could try using Proj4. The geod command will allow you to calculate the geodesic distance between to points. https://trac.osgeo.org/proj/wiki/man_geod I have not used the C++ API, so perhaps someone else can provide an example.


1

You may still have 10dp numbers reported, but count the number of nodes in the modified file, and it should be far fewer that the original. The tolerance unit is whatever the unit of your map data uses. 0.000001° would keep destination paths no more than 0.000001° (a metre 10 cm or so) from their original location. It would be far too small if your data ...


1

No error if you put only gdal_retile. See image below: If you want to run gdal in the IDLE Python GUI or in the MS-DOS Console you can try this: gdal ImportError in python on Windows


0

That is one way to do it. How much time / effort do you want to put into it? With a GDAL distribution, you have the code for ogr2ogr. you could peruse that code and figure out how it does the above command, and then add your processing to that C/C++ utility, thus generating your own. you could replicate that processing in C# by calling the .NET bindings and ...


0

Convert polygons to integer raster, same cell size and extent as value raster, snap raster=v.raster. Use rastertonumyarray on both. Create dictionary. Go through both arrays using integer as key of dictionary and updating list of values from main raster. When done go through dictionary, pick associated list, sort, etc. I've done similar thing on 5000×6000 ...


0

Doing some more searching I found out that a bug related to gdalwarp and NODATA was fixed in version 1.11.2. http://trac.osgeo.org/gdal/wiki/Release/1.11.2-News http://trac.osgeo.org/gdal/ticket/5675 Testing on another machine with gdal 1.11.2 worked.


0

Strangely, it look's like gdalwarp is missing the input vrt NoData declaration (well somehow still it declares it in output tiff...). Which is a bit odd since you said that in step 1. the NoData value is kept. Check if element <NoDataValue>-3000</NoDataValue> exist for each band of your VRT dataset. Beside above isue, you can try to force ...


0

As stated by @Mikkel you will be in trouble because of the large number of layers (r.cross is limited to 10 layers on purpose). Here is the equation if you are able to reduce the number of layers or if you don't have another solution: \sum_i {(n^i) + c_i -1} where i is the index of the image (starting at 0), n is the number of classes, and c_i is the ...


1

the most easy way to do this in a script is to use the subprocess module and gdal_translate import subprocess image_in = "path_input_image" image_out = "path_output_image.tif" subprocess.call(["gdal_translate.exe","-co", "TILED=YES", "-co", "COMPRESS=LZW" "-ot", "Byte", "-scale", image_in, image_out ] if you are in Linux, you don't need the ".exe" after ...


1

You can do that directly in QGIS with Raster -> Conversion -> Translate (Convert Format). To test it, I used a Float64 (Sixty four bit floating point) raster (named test) loaded in the Map View of QGIS. To convert it to Byte (8 bit type), I named it first at the "output file space" as test_byte.tif and afterward, I click in the icon pencil of "Translate ...


0

The main thing is getting a correct connection string, so you're doing the right thing playing w/ ogr_fdw_info until you get a connection working. "MSSQL:server=localhost\SQL2012Express;database=ProSpatial;trusted_connection=yes;" Here's an OGR connection string I found online, and there's another on here at GIS.SE, Shapefile to MSSQL with ogr2ogr fails ...


1

I have added a few intermediate steps to change longitudes from 0/360 to -180/180: gdal_translate HDF5:"GW1AM2_20141231_01D_EQOD_L3SGTPWLA1100100.nc"://Time_Information ti.tif gdal_translate -a_ullr 0 90 360 -90 -a_srs epsg:4326 ti.tif deg.tif gdalwarp -t_srs epsg:4326 -wo SOURCE_EXTRA=1000 --config CENTER_LONG 0 deg.tif degree.tif gdalwarp -of "ENVI" ...


1

I do not know why you get an error but compare your results with mine. Download first this file https://hub.qgis.org/attachments/8536/Trecks.gdb.zip Unzip (it will create a directory) and run ogrinfo ogrinfo Trecks.gdb Had to open data source read-only. INFO: Open of `trecks.gdb' using driver `OpenFileGDB' successful. 1: Venedigertreck_3D (3D Multi ...


0

Try opening it in qgis and see if you can access the objects as described. You choose vector>Directory>click on souce type and choose OpenfileGDB or alternatively try to convert it to other formats using ogr. If it fails then upgrade gdal. If qgis can open this then you might be having two versions of gdal


0

Did you compile your own copy of GDAL? If so you should remove any GDAL packages originating from Ubuntu or UbuntuGIS repos, and recompile GRASS GIS from source code to match your new libraries (be sure to run "make distclean" prior to compilation).


1

To proof the projection string, you can load the WKT of the neatline directly into QGIS, on a tiles background: The green line uses the CRS from your PDF, and the red one uses SRID 102024. Project CRS is the first one, that's why it looks like a rectangle. By the way, I had put your PDF WKT definition into a .prj file, and ran gdalsrsinfo on it to get ...


0

Condensed procedure outlined in http://cartometric.com/blog/2011/10/17/install-gdal-on-windows/ for Windows 7, 32 Bits, to install GDAL PYTHON: 1) Install Python. I installed Python 2.7.9 from https://www.python.org/ 2) Install the GDAL binaries published by Tamas Szekeres. First, I launched IDLE (Python GUI) noting the following values: "MSC v.1500" and ...


0

A Raster Attribute Table (RAT) is the best way to associate string with pixel values. The formats with the best RAT support I know of are ERDAS Imagine (HFA) and KEA (KEA; http://kealib.org/). The steps I would use are: Write a raster with integer values (you can use GDAL to write a NumPy array). Add a RAT containing each pixel value (you can use the ...


-2

Use these commands: sudo apt-get install python-gdal sudo apt-get install gdal-bin


1

You can do that in Python Console of QGIS by using a QgsRasterPipe object (pipe) for setting a renderer clone of the image employed as active layer before to use the 'writeRaster' method of QgsRasterFileWriter class (you don't need gdal_translate). I used the following code: layer = iface.activeLayer() extent = layer.extent() width, height = ...


1

Your best bet to get a weighted choice is to use numpy.random.choice which allows you to specify the sample set, and a weight for each sample. Note the probability must sum to exactly 1. raster = numpy.random.choice([0, 1], size=(rows, cols), p=[0.65, 0.35]) Also, a quick note: your comment says the probability that the landuse should be allocated to 1 or ...


0

As requested, You need to set the include directory properly: GDAL_INCLUDE_DIR=/usr/local/include include_directories( ${GDAL_INCLUDE_DIR} ) on a normal from source build. Some packages install the headers in ${PREFIX}/gdal (e.g. /usr/local/include/gdal), but the build from source does not. Then you have to also link to the gdal library: ...


1

Found it thanks to iant's comment... http://localhost:8080/geoserver/rest/about/manifest.xml?manifest=gs-gdal-.*


0

QGIS has GDAL support to open this kind of images. I downloaded this one, OMI-Aura_L3-OMTO3e_2015m0413_v003-2015m0415t025309.he5, and its last subset was opened with QGIS. It looks like: but CRS was undefined. At the metadata of the image you can observe the spatial attributes of the bounding rectangle. To assing it one projection and a new format: Raster ...


2

One suggestion is to use a VRT(Virtual Raster). There are a number of ways to do this. Use the VRT driver to create a copy of the original JP2 in memory (as a VRT XML string) using the /vsimem virtual memory filesystem, edit the in-memory VRT XML and change the SourceFilename element to point to the new processed raster (using VSFIOpen, VSIFRead and ...


1

As @user30184 says, gdal is just reading the values of your raster band, but you should be able to know the wavenlenght of each band based on the metadata (information you should get about the data). the two values returned by "ComputeBandStats()" will be the mean and standard deviation of the values in your bands. If the mean value is between zero and ...


1

You probably want to write a script, but starting point could be to take a list of the layers with ogrinfo: ogrinfo kml_samples.kml INFO: Open of `kml_samples.kml' using driver `LIBKML' successful. 1: Placemarks 2: Styles and Markup 3: Highlighted Icon 4: Ground Overlays 5: Screen Overlays 6: Paths 7: Polygons 8: Google Campus 9: Extruded Polygon 10: ...


1

See this example Create raster from array Replace the array with your own randomly created array. numpy.random as many random functions that you can use to construct the array as per your requirement


1

In the past, I have used a script to unzip the kmz and extract the bounding box coordinates from the KML and used gdal_translate to georeference the image The LatLonBox coordinates will map to the following values when using gdal_translate ulx = west uly = north lrx = east lry = south gdal_translate -a_ullr ulx uly lrx lry -a_srs EPSG:4326 input.jpg ...


1

You can do the complete procedure perfectly in QGIS (GDAL has HDF4/HDF5 support) without previous reprojection. You have to load all corresponding sub sets at the Map Canvas (sinusuoidal projection by default) and, by using the raster calculator, each image must be multiplied by the scale factor of 0.0001 (Table 2 of ...


2

If you convert from one CRS to another, you will change the cell borders automatically. gdalwarp tries to keep the cell value, but it will also try to interpolate if the new cell size will cover different unreprojected cells. Reducing the cell size with -tr or -ts might solve your problem (but increase the raster file size too).


0

Problem solved! In hindsight, the problem was very simple. The MacPorts installation would run fine (although gdal2tiles.py issued warnings) without the GDAL_DATA environment variable set. So I had come to believe that my problem was "simple" enough not to require additional data files. However, the Anaconda version would not run without GDAL_DATA set ...


0

(Note : this is a partial answer!) I figured out that the .vrt files created by the MacPorts installation and the Anaconda installation were different. The "WKT" string for the Anaconda version contained an additional "TOWGS84[0,0,0,0,0,0,0]" string, i.e. plot.vrt (Anaconda) .... <SRS>GEOGCS["WGS 84", DATUM["WGS_1984", SPHEROID["WGS ...


1

Firstly, welcome to the site! Numpy arrays don't have a concept of coordinate systems inbuilt into the array. For a 2D raster they are indexed by column and row. Note I'm making the assumption that you're reading a raster format that is supported by GDAL. In Python the best way to import spatial raster data is with the rasterio package. The raw data ...


0

From a quick look at matplotlib, i'd say you have to alter the axis scales after the import.


2

If you specify a driver, OGR will only try to open your file with the specified driver. If you don't specify it, OGR will try to open your file with all the drivers. It will loop over all the drivers until it finds a driver with that it can open your file. The order it tries to open them is the same order as listed in ogrinfo --formats. See also this ...


2

Your data are stored as tables rather than gridded (raster) data which could be interpreted by GDAL. It might be easier in the end to work in HDF5 rather than HDF4. Given you're on a Windows box it's easy to download and install the h4toh5 tools from the HDF group which can be used from the command line with (using your example file): h4toh5convert ...


1

My script uses a NDVI (no corrected by scale factor) sub dataset of modis product, for getting the coordinates (sinusoidal projection) for a value of 256 (equivalent to Number_Fire_Pixels = 256): from osgeo import gdal import struct nameraster = "MOD13Q1.A2005193.h10v08.005.2008215173619.hdf" hdf_file = gdal.Open(nameraster) subDatasets = ...


1

If the output parameter is a directory instead of a file name, ogr2ogr will automatically convert all geometry types into separate shapefiles: ogr2ogr out_dir d:\incoming\nhn_09AA001_1_0.gml Unfortunately for the OP this doesn't work for KML, but it does for some of the other multiple geometry type formats like ArcInfo Coverages and GML. Posting here ...


2

Think hdf file as a folder. You want to open the file INSIDE the folder. import gdal hdf_file = gdal.Open("3B43.20140501.7.HDF") # 3b43 rainfall dataset subDatasets = hdf_file.GetSubDatasets() subDatasets >>> [('HDF4_SDS:UNKNOWN:"3B43.20140501.7.HDF":0', '[1440x400] precipitation (32-bit floating-point)'), ...


1

i don't recall all the steps i used, but with the anaconda distro, i placed a text file (something like qgislibs.pth) within my anaconda directory (or you default python install) - within the text file, include the path to your osgeo4w site packages - probably like C:\OSGeo4W64\apps\Python27\Lib\site-packages\ i think i also had to include a path in the ...


2

If you are in doubt, apply a zoom level option of --zoom 8-12 and check all resulting output folders. It always worked for me with this option.


2

To run gdal2tiles.py on a multiple images, use gdalbuildvrt to build a virual raster from those images first. Then you can run gdal2tiles on the .vrt file. gdalbuildvrt -o merged.vrt file1.jp2 file2.jp2 .... gdal2tiles.py merged.vrt output_folder/ If you are running it on large files, check out the enhanced version of the script that uses parallel ...


3

For merely converting a raster from one format to another, many of the GDAL tools will do that along with their specialized functions so either GDALWARP or GDAL_TRANSALTE will do fine for your purposes (which also explains why they give you the same error). The information you mention in the documentation in your links is applicable to using GDAL. Most of ...


1

This code (modified to include any datatype) uses the raster loaded directly as active Layer in QGIS (see next image): import sys, struct from osgeo import gdal from osgeo import gdalconst import os minLat = -48 maxLat = -33 minLong = 165 maxLong = 179 layer = iface.activeLayer() provider = layer.dataProvider() fmttypes = {'Byte':'B', 'UInt16':'H', ...


2

It is necessary to clarify that "l10g" is a DEM tile from the GLOBE website (Python Geospatial Development, p.120) and is a valid raster (raw elevation data). You must also download the hdr (l10g.hdr, book p.120 and explanations of Gabor Farkas) The l10g, l10g.hdr and histogram.py files should be in the same folder D:\Python\Progies\Geospatial\l10g\ To ...


1

There are three problems with your code/approach, which I would like to help to resolve in a quick and explicit manner: The raster data cannot be processed by the algorithm on its own. It needs a header file to access georeference information. Header files can be downloaded from here for the example dataset, as stated on page 120. You have to declare ...



Top 50 recent answers are included