Tag Info

18

You can do this using a cursor to grab the data from your table and write to a comma-delimited text file. EDIT: I'm adding a more concise block of code to accomplish the task using the csv module of Python New Answer using arcpy.da cursor: import arcpy,csv table =r'c:\path\to\table' outfile = r'c:\path\to\output\ascii\text\file' #--first lets make a ...

14

I know these data very well. They are the slightly notorious NOABL windspeed data. You are also on the right track in converting them to an ASCII raster though. The header I created for them (many years ago) was as follows: ncols 700 nrows 1300 xllcorner 0 yllcorner 0 cellsize 1000 nodata_value -999 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

12

In the Esri world an .asc file usually refers to the output created by the GRIDASCII command (ArcInfo Workstation) or Raster to ASCII tool (ArcGIS for Desktop). In practice it can mean just about any format, usually plain text, meaning one can't assume from the .asc extension what it looks like inside. It's an interchange format, meaning it's not (normally) ...

11

The NoData value is missing in your ascii file and you have x|| and y|| instead of xll and yll. I am assuming that your NoData is -999. try this: NCOLS 700 NROWS 1300 XLLCORNER 0 YLLCORNER 0 CELLSIZE 1000 NODATA_VALUE -999 Your ascii open in a text editor should look like this: NCOLS 700 NROWS 1300 XLLCORNER 0 YLLCORNER 0 CELLSIZE 1000 NODATA_VALUE -999 ...

9

You can use numpy. See the example below. A numpy masked array can be generated accounting for the no data values. See the numpy help topic for mafromtxt and genfromtxt Below is a small ascii file with a nodata value of -999 ncols 3 nrows 3 xllcorner 0 yllcorner 0 cellsize 1 NODATA_value -999 0 1 2 -999 4 5 6 7 8 ...

7

One row is too small a sample to be conclusive, but it certainly appears to be DMS (specifically, dDDMMSSHH, with an implied west longitude). You can confirm this by scanning the file and looking for a value of 60 or larger in any of the MM or SS elements. If it is in this format, then conversion to decimal degrees is as simple as parsing out the minutes ...

6

I have used NBI data several times, once in this article I wrote for ArcUser years ago, and a couple of times in training sessions. Here's a function that will parse the space-delimited version of NBI and return you a list of some of the bits (haven't used it in a while, but should get you going). Also, here are the NBI data docs. def ...

5

GRASS GIS r.out.xyz tool You can use the r.out.xyz tool in the GRASS toolbox in QGIS. The function exports a raster map as a list of x,y,z values into an ASCII text file, skipping x,y coordinates for raster cells containing a NULL value. For more information, see the r.out.xyz help file. The disadvantage is that you need first to create a GRASS database and ...

5

In QGIS, then the Add Raster Layer (menu or toolbar) is your best bet: Layer: Add Raster Layer .... You could also use the Python console (see the pyqgis cookbook). You may choose to load the layer, but you may also convert the file without adding it to your map canvas. Select the Raster: Conversion: Translate (convert format) menu option. The 'input ...

4

You want raster data statistics. See what you are doing in the gui first (for homework.) Then you can use a python window or a script. import arcpy arcpy.CalculateStatistics_management("c:/data/image.tif", "4", "6", "0;255;21")

4

You may want the "Export Feature Attribute to ASCII", cleverly named arcpy.ExportXYv_stats http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//005p0000003v000000 import arcpy feature = "path to feature here" # fieldnames must be explicitly provided. Note that you will get additional fields based on the feature type (e.g., "XCoord" and "YCoord" ...

3

Keep it simple, see qgis: Obtain all elevations points from a raster DEM: Go to Raster menu,Conversion sub menu,convert, and choose (you have the list of all the possible formats in GDAL raster Format) [GDAL]XYZ -- ASCII Gridded XYZ (X,Y,Z format) the result is a text file with the x,y coordinates of the center of the cells of the grid,and the value of ...

3

Your bio1_test.asc file is in GeoTiff format (despite the .asc). I had the same problem using the Raster -> translate (Convert Format) form. If you look in the command box at the bottom of the form you will see something like: gdal_translate -of GTiff C:/***/bio1_test.tiff bio1_test.asc change this to: gdal_translate -of AAIGrid C:/***/bio1_test.tiff ...

3

GDAL is a free geospatial raster translation program that will convert USGS sdts dem to USGS asci dem. A Mac installer is available here gdal installers. I'm unfamiliar with a Mac, but you will run gdal_translate.exe from a command line. Something like gdal_translate -of USGSDEM 1661629.DEM.SDTS. -of is the output format. The gdal_translate command help ...

3

I would try using the batch grid control. Instead of double-clicking or using right-click to Open a tool, use right-click Batch. If your 160 feature classes are all in the same workspace you should be able to multiple-select them in the Catalog window and drag them into the first column. I tested it below and it seemed to run OK.

3

The easiest way, apart from Layer|Add Raster Layer... is to just drag and drop it to the layers window. If you also want to translate it, then Raster|Translate (Convert format) is the tool for the job. All that does is wrap the command line tool gdal_translate, part of the excellent GDAL tools and library). On the stackexchange sites, it is usual to give ...

2

Assuming you're using ArcGIS 10, you can use the arcpy RasterToNumPyArray command to get a NumPy array, which if you read the NumPy Input and Output routines documentation you can see you can easily dump the raster data to disk as a text file with a format of your choice. For example: import arcpy import numpy as np arr = ...

2

You write "I have raster in .bil format" - fine, but you also need to have the related metadata. Then you write "which I want to save in GRASS GIS with r.out.ascii." - likely you want to import the map into GRASS GIS? Then it is r.in.bin. If you want to export a raster map from GRASS to BIL, then use r.out.bin or r.out.gdal. If to ASCII format, then ...

2

I think you need to import the file to a Grass GIS dataset then after that you can export to the format you wish. Also you can easily convert "GUIless" way, it using GDAL with this command on your shell gdal_translate -of AAIGrid yourfile.bil outputfile.asc This is for Arc/Info type more options here Gdal Raster formasts Or try Saga GIS if none of the ...

2

edit - now tested and working - edit - improved code import sys class Ascii_file(object): def __init__(self,file): self.raster_file = open(file, 'r') # Open the file self.max=sys.float_info.min self.min=sys.float_info.max def __minmax(self,value): if value>self.max:self.max=value if ...

2

In ArcGIS you can do this: Convert your raster to point vector file. ArcGIS tool Raster to Point (Conversion) Add x and y colum to point file and calculate x and y-coordinates. ArcGIS tool Add XY Coordinates (Data Management) the x and y coordinates are the coordinates of the pixel center. Use Field Calculator to calculate xllcorners and yllcorners ...

2

Esri grid formats are proprietary binary files. There is no such thing as an ASCII version of grid files. There is an ASCII transfer format, which your post references. I've never tried loading floating-point data in an ASCII file, but I know that 16-bit signed data would be accepted (integer grids are 32-bit signed data). The ASCII data is converted to ...

2

Your problem lies in the use of the r prefix on the string in the variable newpath_01. Using this forces it to use a strict ASCII character set. The error shows that character position 47, does not fall in the 128 character ASCII range. The à in Università, is not in the basic ASCII character set. When you assign the r prefix instead of just a regular ...

2

Try las2txt in the libLAS library. las2txt allows you to output ASRPS LAS files into ASCII text. Example: $las2txt -i lidar.las -o lidar.txt -parse xyz converts LAS file to ASCII and places the x, y, and z coordinate of each point at the 1st, 2nd, and 3rd entry of each line. the entries are separated by a space. There is also the Feature ... 1 If you have Line or Polygon data, ArcMap Add XY Data will not work. However, there is a free tool from ESRI, Create Features From Text File. sample tools. You can find the text file formatting online, search ArcGIS 9.2 help. 1 The worldclim data is in Geotiff format and Maxent uses ASCII files in ESRI .asc format. The conversion should be relatively simple. If you have access to ArcGIS, you can load the Geotiff and export it using the "Raster to ASCII" tool If you use QGIS then load the raster, go to Raster -> Conversion -> Translate -> as file type choose Arc/Info ASCII Grid ... 1 You can use gdaldem color-relief from the Raster menu to do this: Raster -> Analysis -> DEM (Terrain models) Change the Mode to 'Color relief'. You'll need to make a text file that sets the rules for colouring the (asc) raster according to pixel value. See the section on color relief here: http://www.gdal.org/gdaldem.html for guidance. This is ... 1 The problem is in the python code. The following line of the error message highlights the problem: "C:/Users/Gidi/.qgis//python/plugins\layers_by_field\layers_by_field_dialog.py", line 146, in split self.vlayer = QgsVectorLayer(vProvider.dataSourceUri(), str(layer.name()) + "_" + str(uValues[j]), "ogr") UnicodeEncodeError: 'ascii' codec can't encode ... 1 You can simply import them in a loop like this: for myfile in ls 5*-7*_dem_1m.asc ; do # remove .asc extension outname=basename$myfile .asc # import current file r.in.gdal input=$myfile output=$outname done # mosaik the tiles r.patch input=g.mlist rast pattern="5*-7*_dem_1m" sep="," output=dem_1m # colorize the result r.colors dem_1m ...

Only top voted, non community-wiki answers of a minimum length are eligible