Tag Info

New answers tagged

1

For Internet People in the Future: an ubuntu upgrade had interfered with the source-built gdal install. i am unsure what exactly was being referenced wrong, but removing the repo gdal package and rebuilding gdal seems to have removed the error.


1

To solve my issue, I had to use the debug option in the command ogr2ogr --config CPL_DEBUG ON -f GFT "GFT:access=<authorization token>" ~/countries.shp The returned output was Shape: DBF Codepage = LDID/87 for countries.shp Shape: Treating as encoding 'ISO-8859-1'. OGR: OGROpen(france.shp/<persistent_session_code>) succeeded as ESRI Shapefile. ...


2

Looking at GDAL autotests, I see only the refresh token is defined. As far as I understand the code, the access token will be automatically got from the refresh token (since the access token is apparently renewed from the refresh token, so it is not practical setting its value directly). So try to undefine the access token ("GFT:" as connection string), and ...


0

To convert GeoTIFF to XYZ you can simply use: gdal_translate -of XYZ geotiff.tif geotiffas.xyz From python for all tif files in the directory: def main(my_path): import os import subprocess # What/Where to load and save source_directory = my_path target_directory = my_path # Create dir for processed files if not ...


0

On Windows: Save text file as a "batch file" by changing the file extension from ".txt" to ".bat" double-click that file and away you go.


-1

So after installing OSGeo4W, another Python has been installed on my system. My previous Python was 2.7.10 and this new one (in OSGeo4W folder) was 2.7.5. So, I completely erased OSGeo4W package following this post and the new installed Python was removed as a result. Then, I followed instructions on this page exactly and managed to install osgeo package. It ...


2

Because OSGeo4W installs its own local Python site, there are certain environment variables that must be set to use it. The simplest way to do this is by running the "OSGeo4W Shell" and then running python from the resulting command line. Alternatively, you can inspect the "OSGeo4W.bat" batch file in the root of your OSGeo install folder for ideas about ...


0

I'm afraid it is up to the PDF creator how to name and number the raster and vector layers. New USGS Topo sheets are combined GeoPDF, and a sample file (NM_Santa_Fe_20131108_TM_geo.pdf) has this output from gdalinfo: LAYER_00_NAME=Map_Collar LAYER_01_NAME=Map_Collar.Map_Elements LAYER_02_NAME=Map_Frame LAYER_03_NAME=Map_Frame.Projection_and_Grids ...


0

It looks like the ability to create rasters is not yet available in the driver. However, you can create a layer using your standard PostgreSQL Python driver (i.e. psycopg2) and then open it from GDAL. So you'd create a layer using ST_MakeEmptyRaster and ST_AddBand: CREATE TABLE rtest (gid serial primary key, rast raster); INSERT INTO rtest (rast) VALUES ...


0

I hope I don't commit any faux pas by providing AN answer. This is not really THE answer, but something I've been using in the interim. I thought it might be useful to someone else. The script compares the text of the layers between gdalinfo and ogrinfo to infer which ones are raster. This approach isn't definitive though, so I imagine it could be wrong ...


0

I agree with Micky T, it looks like you are using the wrong proj4 string. First, you will need to ensure which projection your numbers are in. WGS84 is the datum, not the projection. One possible projection is UTM, which defines your starting point for your easting and northing in meters. The x and y values that you give sure look like they are a ...


0

I suggest you to use MapProx (http://mapproxy.org/) which does what you need. Alternatively, see this answer which develops your procedure a bit further: How do I create a mapserver config file for tiles downloaded from WMTS service? .


1

The two top answers by @SCW and @Mike Toews are great. The site listed by Mike is for unofficial binaries - which was very useful when 64 bit GDAL was not readily available (as per the time he wrote his reply), but it has been now for some time. I have added this alternative answer here as, although I have mentioned it many times, it still keep cropping up ...


0

for resolve the problem of black areas is necessary to proceed this way: 1) create a virtual mosaic of the images with the param -vrtnodata 255: gdalbuildvrt test.vrt -vrtnodata 255 *.tif this add a white background to the mosaic see this explanation: http://lists.osgeo.org/pipermail/gdal-dev/2010-January/023032.html 2) download the correct prj file from ...


0

I've found a working solution based on openlayers 3.7 i have explained the solution in this post: https://groups.google.com/forum/#!msg/ol3-dev/FQRup_N1Ess/tF-6CyE35_UJ


0

Try to use ogr with python. Step 1: Open you VMAP file using QgsVectorLayer vlayer = QgsVectorLayer(<VMAP location>+"|layername=<VMAP filename>", <newLayeName>, "ogr") if you get True after you run this line it means the VMAP was properly loaded. Step 2: convert the vlayer to Shapefile vlayerToShape = ...


0

I've found a working solution based on openlayers version 3.7 Here is a working example: http://mappe-t.comune.modena.it/prove/demo_ol3/tms_ol3_with_popup.html basically is necessary to create a custom TileImage source this is my code /* CONFIGURATION PARAMETERS DESUMED FROM gdal2tiles generated file ...


2

I tried the files with the GDAL utilities and see the same problem. So I then went into the HDF file with hdfview to see if the data values looked OK and where the projection information was being stored in the metadata. SR-ORG:6932 is definitely not EPSG:6932 as it is a local area map projection for North America. The EPSG definition is at ...


0

I'd think twice before upgrading to GDAL 1.11 if I was you... I also broke my GDAL by installing GRASS 7, so I upgraded to GDAL 1.11.2, and QGIS 2.8. At first this seemed to so fix things, but then I noticed some strange behaviour in QGIS, which I now believe is caused by the new GDAL. When I load rasters, they often appear in wrong locations, and the ...


6

Nice and reproducible question. Personally, I'd expect that the reason for the difference is in the implementations of the bilinear reprojection. You can obviously look into source code for the two approaches, but I'd expect that to be a vast overkill. It appears that the R implementation introduces bigger "errors" / "changes" than the raw GDAL version ...


0

I finally got a workaround by using the Generic Mapping Tool gmt. I used the nearneighbour command, which does the gridding much faster than gdal_grid: http://gmt.soest.hawaii.edu/doc/5.1.0/nearneighbor.html


0

A single 1:1M map sheet can be reprojected and extracted with the following command: gdalwarp -t_srs WGS84 -te 144 -36 150 -32 -crop_to_cutline 76943_Aus t_gda94.ecw AustTopo250_SI55.tif This is dependent on an ecw driver being loaded. Thanks to @user30184 for the tip: GDAL tools does not have a ready made tool for cutting by map sheets. ...


2

Yes. Assuming you're using Python for your plugin, this should cover most things for raster-based processing. from osgeo import osr import gdal from gdalconst import * If your plugin needs to handle vector data, add in from osgeo import ogr If you've done a 'normal' install you should at least have GDAL, and so should your plugin users. This might ...


1

I suggest to visit http://www.gisinternals.com/stable.php. Depending on the Microsoft VC runtime version (2005 to 2013) and win32 vs win64bit, you get a full package of GDAL. Following the information link on the site, you get to know which formats are supported. If you don't need mapserver binares, just ignore them. The installer will not set up a full ...


-1

Maybe try to open like this: from osgeo import gdal driver = gdal.GetDriverByName( ’DTED’) driver.Register() file = gdal.Open( ’path/to/file’) You may have to register your driver, in this case DTED.


1

If you want to work with GDAL on command line, you have to change your input file to comma delimiters: X,Y -5.48,42.81 -4.78,42.52 -5.06,42.02 The appropriate vrt file for it is: <OGRVRTDataSource> <OGRVRTLayer name="test"> <SrcDataSource>test.csv</SrcDataSource> ...


1

<OGRVRTDataSource> <OGRVRTLayer name="test"> <SrcDataSource>test.csv</SrcDataSource> <GeometryType>wkbPolygon</GeometryType> <LayerSRS>WGS84</LayerSRS> <Field name="id" src="id" /> <GeometryField encoding="WKT" field="geo" /> </OGRVRTLayer> ...


0

Try this question. Or you could download FileGDB API directly from ESRI here.


0

Do the averaging yourself? GDAL makes it very easy (especially with the python bindings) to read and write raster pixel data. Read your input files in chunks (if they are large), take the average (very easy with python as you can read the input to numpy arrays then just use numpy to take the average across a given axis), and write it out again.


1

GDAL is the most widely used library to access geospatial data from python. Unfortunately it can be a bit unintuitive from time to time. A recent development trying to make the use of GDAL more pythonic is rasterio import rasterio with rasterio.open('path/to/your/geo.tiff') as ds: ds = src.read()


1

With GDAL: from osgeo import gdal file = gdal.Open(’raster1.tif’) band1 = file.GetRasterBand(1) a = band1.ReadAsArray() In tiff you have 3 bands (RGB). So after you open raster file, you have to get band (1,2 or 3 are Red, Green or Blue) and then read band as array. Of course there could be only one band, but even then you have to get it before ...


1

What finally worked for @RobotCaleb was the following: Apply mask to alpha (band 4): gdal_translate -mask 4 stadium3857.tif stadium3857_RGB.tif 2. Compute a new alpha channel from NoData values: gdalwarp -dstalpha stadium3857_RGB.tif stadium3857_RGBA.tif edit: apparently gdal2tiles does not need an alpha channel in the input dataset but also ...


0

You can use the Select by Attributes tool to select all of the raster features inside the shapefiles. Then right click on the raster in the Table of Contents and go to Data > Export to CAD. Best of luck to you!


0

This same issue happened to me and had nothing to do with the path name. I am able to open the raster OK, but then I find out that the methods that were previously available to me are no longer there . . .


1

I would not be too sure that the downgrade from GDAL 1.11 to 1.10 was really clean. If you want to stick to that GDAL version, I suggest to re-build QGIS again with it. Upgrading to GDAL 1.11 is surely better, but if you need ecw support on Ubuntu, you might run into problems there (see Unable to install ECW support on lubuntu 14.04 for that). On the other ...


6

Esri shapefile fields are limited to 10 characters, no matter how they are created.


2

In your first example you have a simple script, where all modules are imported, parameters are created and your function is executed with these parameters. Your vector data are written to dst_layer. There are few ways to execute your script. You can do this in command line (if you have enviromental variables for python with gdal): $ python script_name.py ...


3

Reading the images works with the gdal palsar driver and therefore also in Python. You have to make sure to point gdal to the VOL file so it works. >>> palsar = gdal.Open("D:\Downloads\psr_fbs15\PSR_FBS15\VOL-ALPSRP150170690-H1.5_UA") >>> pal_arr = palsar.ReadAsArray() >>> type(pal_arr) <type 'numpy.ndarray'> Saving in ...


1

Reading and writing file geodatabase rasters is not supported by the File Geodatabase API as of July 2015. According to this 2010 Esri blog File Geodatabase API details: Rasters (Raster Dataset, Raster Catalog, Mosaic Datasets and Raster Attributes) are not supported with the initial release of the File Geodatabase API. Additionally, according to ...


1

Thanks to user30184, I managed to solve the problem. It seems that the version of the GDAL I had installed, which was 1.11.1, had a problem with the function gdal_polygonize.py. I installed the newest version of GDAL (2.0.0) and it works perfectly!


1

It's been a while since I tried this but it is fairly easy as GML is an output format like any other in OGR. So you should be able to take the tutorial from http://www.gdal.org/ogr_apitut.html and change "ESRI Shapefile" to "GML" compile and run it.


0

In order to merge all features into one, you should do: ogr2ogr output.shp input.shp -dialect sqlite -sql "SELECT ST_Union(geometry) AS geometry FROM input" where geometry is the special field used in order to represent the geometry of the features in SQLite SQL dialect and input in the SQL statement is the input layer name.


0

I am wondering how I can pass in input argument "-n 0" in the command to be used in subprocess. It seems that numeric values cannot be passed in as it onle take text values.


0

Usually I specify -s_srs and -t_srs (source and destination projection system) you can either reference a proj4 name or provide the path to a .prf file, or specify manually your projection parameters. I suspect this might be the cause of your problem since it doesn't seem you ever defined the reference system of your gcp. The GUI might be doing this for you ...


2

Without knowing your dataset I can't be 100% sure, but I'd wager you can solve this by adding -dialect sqlite since ST_Intersects is a Spatialite SQL function. Your command should be /opt/gdal-custom/bin/ogr2ogr -f CSV /vsistdout/ foo.shp -dialect sqlite -sql "SELECT * FROM foo "


1

I guess that ST_Intersects(Geom1, Geom2) will test a spatial relationship between two elements and return a boolean (True or False), what you need here is probably ST_Intersection(Geom1, Geom2) if you want to create a geometry (resulting of the intersections of the two others passed in arguments). (If it is ST_Intersects() that you need, it should probably ...



Top 50 recent answers are included