Tag Info

Hot answers tagged

24

Sorry, the answer is no. You have to roll out your own field mapper and only software that uses your mapper will understand it. You could use other formats that do not have this limitation though (e.g. filegdb, spatialite, etc). UPDATE: Some word of advice about the workarounds from personal experience. When people choose shapefiles (and insist on them) ...


14

I've used Open Office for working with dbf files.


11

Simplest answer I've found, based on Ryan Garnett's advice to do it within QGIS: Use regexp_replace This capability was added to field calculator 1 year ago by J├╝rgen Fischer (as illustrated by this bug report). I tried for a while to find out how to do this, but failed searching for "qgis regex" and other vague terms. It's functionality is probably ...


9

There is a standard way to deal with this, although your clients might not be completely happy with it: you export two files, a shapefile and a data file in a format their software can read. The shapefile has only a unique identifier, [Id], for attributes. The data file has several attributes: [Id] to match the shape, [Field] to provide the field name, ...


9

This is a very simple implementation using Table to Table (Conversion). import arcpy ws = r'C:\temp' file = r'C:\temp\poly.shp' arcpy.TableToTable_conversion(file, ws, "outTable.dbf") For an even more efficient pure python approach, you can copy the shapefile's .dbf file using shutil: import shutil file = r'C:\temp\poly.dbf' outFile = ...


8

For opening and editing, Open Excel 2007 and simply drag the dbf file to it. To create a new DBF file (http://www.excelforum.com/excel-2007-help/643473-save-as-dbf.html): In Excel 2007, Go to "file > Save As.." and choose .csv Now open Access 2007 and Choose import data and select the csv file The data then loads into a table and from there you can export ...


8

Like whuber says, you have to write out the headers explicitly. I loaded up dbfpy and xlwt in a virtualenv and ran this: from xlwt import Workbook, easyxf import dbfpy.dbf from time import time def test1(): dbf = dbfpy.dbf.Dbf("pipelines.dbf", readOnly = True) header_style = easyxf('font: name Arial, bold True, height 200;') book = Workbook() ...


8

This is not an ESRI issue, because the specification of the DBF structure antedates ESRI's use (in shapefiles) by more than a decade. I will discuss the standard dBase III specification, because that is essentially what shapefiles use. (The link in the question is to a much more recent extension of the format, "dBase 7," which is by no means universal or ...


7

Trial and error. Try to open the .dbf file with Ms Excel or with OpenOffice using different setting until you get everything right. Look at this post for more clues: http://stackoverflow.com/questions/319095/how-do-i-determine-the-character-set-of-a-string


7

This may be a dumb answer, as it may be a learning objective for the grad students, but is there a reason why you are not editing the attributes in QGIS with the use of the Field Calculator? In previous versions of QGIS (pre 1.7) editing attributes directly within QGIS was not possible; hence the need for editing .DBF files in OpenOffice etc. As of 1.7 ...


6

There are two ways for programs to determinate the character set for a shapefile. The first is the codepage file *.cpg. The second is the codepage info, which can be inside the dbase file. The specification could be found at http://www.clicketyclick.dk/databases/xbase/format/dbf.html#DBF_STRUCT


6

As all Python programmers, I will first see the Python package Index for dbf files (it is specified if they are not compatible with Python 3 or Python 2). dbfread, for example, works with Python 2.x and Python 3.x. a geospatial modules like GDAL/OGR can be used but it needs to be compiled (Linux, Mac OS X). For the Windows users, Christoph Gohlke provides ...


5

There is a script on the arcscripts website that should assist you in doing this http://arcscripts.esri.com/details.asp?dbid=14534 Summary A simple script for creating a field called "FILENAME" and attaching the filename of the shapefile to each entry in the attribute table. Use with as many shapefiles within a specified directory. Useful when picking ...


5

This topic in the help deals with joining data and may offer a better workflow for your situation although I am not familiar enough with it to say for certain. In your response to your edit, ITable respects joined fields but IFeatureClass does not. This is hinted at in the ISelectionSet help: If you want to obtain a selection set on a feature layer it ...


5

you should have a look on these questions since it has been answered already : Adding custom Feature attributes to ESRI Shapefile with Python http://stackoverflow.com/questions/4215658/adding-custom-feature-attributes-to-esri-shapefile-with-python If you want as result, only one shapefile, just delete your input files at the end of your script.


5

You are approching this wrong. By doing row.field_names[1] you are asking python to give you the field_names method on the row object which there isn't one. Try this: field = arcpy.ListFields("tabulka.gdb\zrazkove_uhrny")[1] name = field.name for row in rows: print row.getValue(name) I think you might even be able to do row.getValue(1) but I'm not ...


4

Thanks to a rather brain-dead format called DBF, adding fields to shapefiles with existing attribute data isn't possible without rewriting or adding padding to the DBF. I don't know of a ready-made solution, but what I would do is write a script to create a new shapefile based on an existing one and add the extra field(s) to the new shapefile. Then copy ...


4

you can use Table to Table (Conversion) more details here or Copy Rows (Data Management) here. both of them have a very similar structure... Usage of Table to Table: This tool supports the following table formats as input: dBASE (.dbf) Comma Separate Value (.csv) tab delimited text (.txt) Microsoft Excel worksheets (.xls or .xlsx) INFO ...


4

With a DB Manager (unless your spatialite version is 3) you are able to execute any query including INSERT, so yes (plus there is spatialite-gui-plugin, but again spatilite 3 is not supported). But I prefer to use for this spatialite-gui in parralel with QGIS. Changes are synchronised nicely (at least so far for me).


4

No...check online for the specs for *.dbf files, they are well documented. ArcGIS has no magic powers to extend the inherent limitations. Consider a geodatabase instead.


3

You could transform the NAs to another value, such as -9999, but unfortunately shapefiles do not support null values (they're built on DBF IV) - by default null numeric values are set to zero, and null strings become zero length strings. Depending on what you want to do with the file afterwards, I'd look at exporting to a format such as Spatiallite, which ...


3

Couldn't you just merge 7 DBFs, summarize based on the pointid, then join the resulting table back to one of the point shapefiles?


3

You can try using the built-in Add XY Data tool. GUID: {55425B75-2CE4-4909-B40A-CFE50FAD1896} (esriLocationUI.AddXYDataCommand) Refer the following SE discussion on the same issue. or Open the XYZ data as a table, the same as opening any other table. Once you've done that, create a spatial reference for the data. After that, the attached code ...


3

DBFpy should work for this. Have you seen then example on this page: http://dbfpy.sourceforge.net/ Make sure the shapefile isn't being edited by any other application including ArcGIS at the time as this may cause issues via locking.


3

As you're using ArcGIS, Aragon's answer should be sufficient. However, you can do it without ArcPy too. Python has a module for reading CSVs. You can then use dbfpy to write out the DBF. I believe there is a PyPi module for reading and writing to XLS, which might also serve.


3

There are a couple of things to look up. Geocoding, and intersect. I have never used magic maps so I can't say if it has this capability but from your sample map I would guess it does. 1. If you don't have location data for your csv, then you can use geocoding. (It sounds like you already mapped your points so I assume this is not the case). The wording ...


3

87 (0x57) is the ANSI code page ID according to this reference. dat=open(dbf,'rb').read(30)[29:] id=struct.unpack('B',dat)[0] print id,hex(id),chr(id) This prints 87 0x57 W on some random dbf I tested. For '949' you should be looking for 78 0x4E. Edit: Below is a look up table (dict) for the code pages copied from the above reference: lut={ 1 ...


3

If you don't have a .dbf file, you probably have an empty attribute table. To get the X and Y of a point layer, you have to add them to the attribute table using the field calculator. $X and $Y from the Geometry section will add the coordinate values. Be sure to change the field type to real, and set the precision greater than zero if using degrees. For a ...


3

The other dBase format you mentioned didn't exist when ESRI published the shapefile format. Other software packages could certainly use the newer format, but it wouldn't be standard and it's likely that only that program could read the files it creates. In my own experience, I've never encountered a non standard dbf accompanying a shapefile. This includes ...



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