Tag Info

Hot answers tagged

18

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


10

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


8

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


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

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


7

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

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

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


6

If your customer is using ArcGIS, you could provide a script to assign field aliases in bulk. This would give them the appearance of long field names when they're using the data. Similar scripting may work to provide aliases in other GIS packages, too.


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

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


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

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

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


3

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


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

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.


2

As to my knowledge and personal experience, this is a general issue when opening files in ArcMap/ArcCatalog or by means of ArcObjects. The lock on those files doesn't get released when they are no longer used in the application. Only closing all ArcGIS applications solves that problem. That behavior is widely known and it's frustrating.


2

I've been using R. In the core packages there is a package called foreign which enables you to read/write dbf files with ease. You can read a dbf file that is associated with a shapefile, and completely overwrite it without problems (assuming that you do not delete a row). You can also just output a dataframe into dbf format, which I sometimes do as it is a ...


2

I've used this add in to save to dbf created by the theXLwiz.


2

for editing, either of these two is handy (never tried to create): http://www.pablosoftwaresolutions.com/html/dbf_explorer.html http://sdteffen.de/gtkdbfeditor/index_en.html


2

It sounds like there is a problem with the spatial reference of one of your layers. Actually, it is more likely a problem of the spatial reference you assigned to the points, being different than the coordinate system the points were actually exported in. Let me explain. You exported a polygon to a shape file. When you did that, you should have assigned ...


2

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.


2

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


2

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


1

You can use LibreOffice's Base to modify your dbf files. Open Base (get Main Menu) Select "Connect to an existing database" and select type "dBASE". Select the folder with your dbf files. Select final options as desired and "Finish". Name your database connection file whatever you want (eg "MyxBasefiles.odb) and save it somewhere. Henceforth ...


1

I don't have a copy of Arc* on hand to test this but I get a different sort of result - it seems that writeOGR DOES preserve NAs? Carrying on the code from @CCID above: # have a look at the dbf file xf <- read.dbf("example.dbf") xf Gives: ID Data 1 1 1 ... 5 5 5 6 6 NA 7 7 NA ... In QGIS the attribute table also shows NAs: ...



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