Hot answers tagged

26

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 ...


15

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) ...


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 ...


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

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 ...


9

What about the liblas Python API (not sure how lightweight this is though)? >>> from liblas import file >>> f = file.File('file.las',mode='r') >>> for p in f: ... print 'X,Y,Z: ', p.x, p.y, p.z


8

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 ...


8

You already have a DEM; there is no need for you to create one. The DEM is contained within your files, i.e. you have two copies of the DEM, one contained within an ArcGIS ASCII raster and the other within a GeoTIFF. These are simply file formats that contain the raster data that is your DEM. One of the most common formats for a terrain model is as a regular ...


6

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" ...


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

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 ...


5

What about the Export Feature Attribute to ASCII Tool in the Spatial Stats Toolbox? It's available at all license levels.


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

The easiest way would be to use ogr2ogr from the GDAL package (an open source spatial conversions library) and convert your feature class to a text format such as GeoJSON (and the specification). I'd strongly recommend this method if possible, especially if you don't have much programming experience. If you don't have access to this (can't install it, or ...


5

Given your error, my guess is that when you are importing the file to GRASS, it is expecting a GRASS ASCII raster format, which has a header that looks like this: north: ####.### south: ####.### east: ####.### west: ####.### rows: ####.### cols: ####.### Instead of an ArcGIS ASCII grid, which has a header that looks like ...


4

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 ...


4

add the data as txt or csv. then right click and "display xy"


4

The idea behind integer rasters is that the value(s) are associated with some finite discrete entity. Processes such as soil, landcover or binary processes are well represented as integer rasters. The attribute table is intended to be associated with group of pixels associated with a discrete value. This is why the attributes contain value and count fields. ...


4

For this task you don't need arcpy, only dbfpy library. Here is the code found on github: import csv from dbfpy import dbf import os import sys filename = sys.argv[1] if filename.endswith('.dbf'): print "Converting %s to csv" % filename csv_fn = filename[:-4]+ ".csv" with open(csv_fn,'wb') as csvfile: in_db = dbf.Dbf(filename) ...


3

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 ...


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

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

Assuming you want to use ArcGIS to convert the polygon features to a table, which will then be be used in different software, try the following: Open your feature attribute table Add Field > Type Double > Label "x" Right click on the new field name "x" and select "Calculate Geometry" Choose Property: "X coordinate of centroid" > OK Repeat steps 2 - 4 for ...


3

There are many files called ASCII or GRID, it can be very confusing to work out which is which. A good text editor like Notepad++ or TextPad is invaluable in determining what you actually have. An Esri ASCII Grid will look like this: ncols 1000 nrows 1000 xllcorner 489000.000000000000 yllcorner 6679000.000000000000 cellsize ...


3

Use the Add delimited text tool or Layer/Add layer/Add delimited text from the menu: This way you get points in QGIS.


3

To convert an ASCII file with longitude, latitude and data value you may use a function like this: from osgeo import gdal def csv2tif(source, target): cvs = gdal.Open(source) if cvs is None: print 'ERROR: Unable to open %s' % source return geotiff = gdal.GetDriverByName("GTiff") if geotiff is None: print 'ERROR: ...


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

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 ...



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