Tag Info

New answers tagged

0

GDAL_Calc will perform this operation: gdal_calc.py -A weight_raster -B elev --outfile=result.tif --calc="B*(A>0)" --NoDataValue=0 This multiplies B (elev) by A > 0 which is 0 for less than or equal to and 1 for greater than (boolean 0=False, 1=True) so the raster will be 0 where B fails the test and A where B passes the test. Note that this will cause ...


2

For this, you need to create new ogr features and save them to the layer and not simply create geometries ( geom1.AddPoint(linkpoint[0],linkpoint[1]), feature1.SetGeometry(geom1)), with dataSource.SyncToDisk() at the end (SyncToDisk() might be helpful to ensure that a particular feature is flushed to disk but it is not necessary here, look at the script). # ...


0

If the imported image consists of several bands, they are always extracted as separate raster maps channels (yours JPEG_8.blue JPEG_8.green JPEG_8.red) To combine and display these three raster maps, use the button (or d.rgb) To write out the color composite map use r.composite from the dialog: or from the command line r.composite ...


1

Your buffer distance is given in the units of your dataset. Your coordinate system is lon/lat geographic. Thus 0.01 = 0.01 decimal degrees. To be able to buffer by 1 km (1000 m) you need to reproject your dataset to a projected coordinate system which has units in metres. There are examples in the Python GDAL/OGR Cookbook of how to reproject layers and ...


2

I had the same problem. This should solve the bug (QGIS 2.6 under Windows): close QGIS using regedit.exe, search for "Plugin-GeoReferencer". This should point to a folder under \HKEY_CURRENT_USER\Software\QGIS\QGIS2\Plugins (optional: export a .reg version of the folder for back-up) delete the folder "Plugin-Georeferencer" restart QGIS. Georeferencer ...


0

Move the polygon to the right and down or the raster to the left and up. I would shift the Polygon using QGIS edit tools (or Arc) if you have access as opposed to moving the polygon in GDAL warp.


0

Why don't the polygon and image line up? They both have the same coordinate system but does the image have a world file as well? One way to get an image to be located in a particular coordinate space is to georeference it. For example, if you were using ArcMap you would use the Georeferencing toolbar and then add control points where a location on the image ...


0

Export your image to a format where the coordinates are numeric and text, good choices are Tiff + world file, BIL/BSQ (EHDR) or Esri ASCII Grid (AAIGRID). If you choose Tiff/world then you will need to destroy the embedded georeference using photoshop/gimp. Open the world file/header and edit the coordinates. You should be able to calculate the x & y ...


1

I think it's the alpha band that's causing problems. To extract the data band: gdal_translate -of hfa -b 1 original.tif band1.img Then to warp: gdalwarp -of GTiff -s_srs epsg:4326 -t_srs epsg:3857 -co "tfw=yes" band1.img band1_warp.tif Gives an image: With GDALINFO > Driver: GTiff/GeoTIFF Files: D:\Testing\Tiff\band1_warp.tif > ...


1

If you don't need to stretch or rotate your raster, you can use the Shift tool (Data Management -> Projections and Transformations). Measure the offset in x and y, then run Shift incorporating these values. edit: this answer assumes ArcGIS, as listed in the original tags


0

Are you using ArcMap? Here's a way to form a polygon to your raster dataset: (1) Multiply your raster by 0 using Raster Calculator. This is to generate a single value raster grid. (2) Use Raster to Polygon to convert the raster dataset to a boundary polygon. You can choose to smooth the polygon or not.


0

Having worked this out, I should point out a flaw in my question: there is no SetMercator2SP in the python bindings. There is only one SetMercator and you use it to emulate SetMercator1SP or SetMercator2SP by choosing arguments. From what I have seen online, it is possible there are some programming mistakes ... not suprising since this isn't the most common ...


1

You can use the osr module (part of the standard GDAL install, so it should come with your Python bindings) and do something like this: import osr import gdal inDS = gdal.open(r'c:\somedirectory\myRaster.tif') inSRS_wkt = inDS.GetProjection() # gives SRS in WKT inSRS_converter = osr.SpatialReference() # makes an empty spatial ref object ...


0

In addition to AndreJ's answer, the gdalwarp command can be simplified as this: gdalwarp -s_srs EPSG:28193 -t_srs EPSG:4326 -of GS7BG in.grd out.grd No need to specify the entire proj.4 definition. On Linux systems this might work, as root: ln -s /usr/lib64/libproj.so.0 /usr/lib64/libproj.so


3

For the first part of your question: GDAL can guess the format of the input file from the file extension. The output format is defined by the -f option. If it is missing, Geotiff is assumed, but you get that warning if the file extension is not .tif. For a .grd output, you can select between GS7BG (rw+v): Golden Software 7 Binary Grid (.grd) GSAG (rwv): ...


0

Brian, you could ask this question at http://lists.osgeo.org/mailman/listinfo/gdal-dev/ and perhaps get a more specific target audience. Also, while not providing a GDAL way to accomplishment this page (http://www.yale.edu/ceo/Projects/swap/landcover/Unsupervised_classification.htm) gives a nice summary of the differences between KMEANS and ISO DATA perhaps ...


1

The gdalbuildvrt program isn't the right tool for this task. It's for making virtual mosaics and multiband images. I suggest this approach: Define the domain in which you want results (geotransform, rows and columns). We used to call this a "canvas" back in the day. Warp (gdalwarp, nearest neighbor) your source TIFFs to that domain, producing TIFFs with ...


2

You can use URLs as paths to OGR data sources, so you don't need curl or pipes. ogr2ogr -f KML countries.kml https://raw.githubusercontent.com/nvkelso/natural-earth-vector/master/geojson/ne_50m_admin_0_countries.geojson


5

OGR has its own idiom for stdin, /vsistdin/. Use that as ogr2ogr's first argument (the dst_datasource_name) and you can pipe curl's output to it: curl "https://raw.githubusercontent.com/nvkelso/natural-earth-vector/master/geojson/ne_50m_admin_0_countries.geojson" | ogr2ogr -f "KML" countries.kml /vsistdin/


2

Here is some of my C++ code for working with triangles: Structures, in order to understand my code understanding these structures is necessary: struct CoPair // linked list of coordinates { long ID; float X; float Y; float Z; CoPair *NxtPt; }; struct Tri // linked list of triangles made from 3 CoPair { bool Active; CoPair *A; ...


0

GDAL comes with a gdal_grid utility to create a regular grid from scattered data. I'd start with this one since it seems that you are already using GDAL tools. If you have dense LiDAR data, check out LAStools, such as las2dem or lasgrid.


1

You can by using GDAL following this discussion on GDAL-dev mailing list. As stated in the mentioned topic, you need GDAL compiled with Spatialite support. An alternative is already provided on the forum at TopoJSON level by @mbostock


0

I tried solving this by re installing fiona. I was having the same problem. I installed fiona 1.4.8 and it solved the problem.


0

I had the same problem, and then tried building gdal 1.11.1, that seemed to find the library nicely. I'm not sure if it may be checking for version as well as path, or which version of GDAL starts working with libkml trunk as of 2014-11-09.


2

polygonize is not a segmentation algorithm, it is a region grouping algorithm (only group pixel that touch and have the exact same value), so there is no special operator. Basically here is what it does (probably optimized) : initialise region count at zero you run through all pixel assign a value of region count to the first pixel that you meet if ...


0

Hope this one helps. Use GDAL rasterize to conver polyline to raster, then it is possible to run r.neighbors with a 3 (by 3) sized neighbourhood. see also in this post. This is my result on some lines drew on WGS84. This is only a snapshot but the method works for all featurs and/or raster cells. Original polyline colored yellow, in black are the polyline ...


1

After finding the geopdf files, I get the same error message with GDAL 1.11.0 that was shipped with QGIS Chugiak, although gdalinfo --formats lists the pdf driver as rw. But it works with GDAL 1.11.1 shipped with QGIS Brighton, current OSGeo4W and the binaries from gisinternals. See also How to add Georeferenced PDF as layer to QGIS 2.0? for some bug ...


0

Off the top of my head, I don't think that you will get a line string or polgon string of x and y values in csv. I believe that you will only receive point values if you pick csv. You will have a column for x and a column for y. The gdal libraries that read shapefiles treat the three files as one animal. These libraries already do all the work of ...


2

All of the vector formats supported by GDAL/OGR are listed here. With each driver, check out the creation options to control the output. These are passed to ogr2ogr using -dco and -lco flags. Good text-based output drivers include: CSV - be sure to use -lco GEOMETRY=AS_WKT to get the well-known text geometry GeoJSON GML KML LIBKML.


0

Compression doesn't work well in the process of generating a new file with "tiled=yes" or above a certain file size. I solved this problem as supposed by Michael: Create your hillshade by compressing it with lossless LZW. In my example, the whole planet warped with 500 meter resolution, the hillshade-500.tif consumes 131 GB. gdaldem hillshade -z 4 ...


1

What you are looking for is Geographic Markup Language (GML). It is human readable and should maintain everything. -f gml in gdal / ogr. Do not overlook KML either. Both are human readable vector OGC standards supported in gdal / ogr. You can open both in text editors.


5

Sure you can use the No Data value in gdal_translate -a_nodata value: Assign a specified nodata value to output bands. Starting with GDAL 1.8.0, can be set to none to avoid setting a nodata value to the output file if one exists for the source file. or in gdal_cac.py use the less than (<) or greater than (>) or equals (=) commands. For example, below ...


4

[Edited] If your feature classes are saved as *.shp, you could try: ogr2ogr -f "FileGDB" mygdb.gdb ~/PathTo/MyFeatureClass.shp -lco FEATURE_DATASET=my_features However, since you are exporting from PostGIS another approach could be something like this: ogr2ogr -f "FileGDB" mygdb.gdb PG:"host=my_host user=my_user_name dbname=my_db_name ...


1

Euclidean Allocation The only tool I know of, that specifically supports Euclidean Allocation based on euclidean distance calculation is Whitebox (see also their Help section). Region Growing I don't know the exact problem you are working on, but my guess is you can also solve it with region growing - a process quite common in image segmentation and ...


0

I came across this It is very simple. Example: for gdal_polygonize hello.png bla you can use: import java.io.IOException; import org.apache.commons.exec.CommandLine; import org.apache.commons.exec.DefaultExecutor; import org.apache.commons.exec.ExecuteException; public class Test { public static void main(String[] args) throws ...


0

Ok. I finally got the drawing of the lines direction arrows by a little bit of trigonometry in the PostgreSQL(PostGIS) Query that generates the geometries for the ogr2ogr command to export it to the DXF file. The arrow triangle I get is not perfect, it has the tail a little bit moved but it will be enough for my needs. First I get all the points of the ...


0

I don't quite know why but when I accidentally typed .png twice (C:\OSGeo4W64\bin>gdal_polygonize star.png.png bla) it worked.


2

The task could feel trivial by reading the gdalwarp documentation http://www.gdal.org/gdalwarp.html and GDAL AAIGrid -- Arc/Info ASCII Grid driver documentation http://www.gdal.org/frmt_various.html. The target pixel size is three times bigger than the native resolution 0.008333333333 degrees/pixel (not 1000 m/pixel, see the comments). gdalwarp -of AAIGrid ...


0

The ArcGIS Data Reviewer would seem likely to meet your requirements: Data Reviewer consists of a series of tools that support both automated and visual analysis of your data. It can be used to detect anomalies with features, attributes, and relationships in your database. Data checks contain the analysis rules and can be scheduled to run ...


1

I found that ArcGIS when creates the pyramids on a raster added in a data frame, by default sets 8 levels of pyramids. If in gdal I add 8 levels, then ArcGIS it doesn't ask me again if I want to create the pyramids. So the GDAL command is: gdaladdo -ro file.tif 2 4 8 16 32 64 128 256 --config COMPRESS_OVERVIEW LZW


0

Now you can use virtualenv and setuptools friendly version of standard GDAL python bindings pygdal.


0

i have the same problem, but if you first install qgis and then install postgres and postgis works


0

I clearly didn't use it at the moment but following the GDAL official Travis build configuration file should help you sort out the issue. Just for info, this configuration file is for testing GDAL code on Ubuntu. Trying on my computer only GDAL with kml integration, it works after below operations when testing with official example: wget ...


0

If you have data from the poles, avoid EPSG:3857, because that is undefined at the poles. Reprojection might fail, and the rest of the data might get lost. Try EPSG:4326 instead. To get the full picture, include the target extent (for the Arctic region): gdalwarp -t_srs EPSG:4326 -te -180 -90 180 90 northpsg.20141027 output.tif and you will get your ice ...


2

GDAL does not recognize the file as ERDAS imagine, as promised by the extension .img. But it looks only at the file extension, and does no further investigation on the content of the file. EDIT Comparing with other data from the site, they seem to provide unformatted raw binary. The mask should be 17347 lines by 40031 samples (columns) So I created an ...



Top 50 recent answers are included