16

I am trying to find out if the : character is allowed in the name of ESRI's shapefile field.

I googled, but I couldn't find an answer. Here is an interesting quote from the article from ESRI FAQ stating:

Eliminate any characters that are not alphanumeric character or an underscore.

Does this mean that the : character is not allowed? Or is it allowed to use it, but it is recommended not to use it? If yes, then why?

22

Field name restrictions inside a shapefile are determined by dBase limitations. There are four single rules:

  1. Up to 10 character max.
  2. First character in field name must start with a letter.
  3. Field names are unique.
  4. And, from Understanding DBF Essentials

(...) they can contain any combination of the letters A through Z, the digits 0 through 9, the colon (:) (in dBASE II field names only), and the underscore (_).

ESRI Shapefile works with dBase III+.

| improve this answer | |
  • 1
    Can you upload a part of your .oms file? I want to check what happens or if are an alternative way to export that kind of data – aldo_tapia Nov 27 '16 at 13:14
  • 1
    I tried in R using osmar and rgdal without problem, works perfect. I check field names in QGIS and are right. A basic and simple code . And results, check them. – aldo_tapia Nov 27 '16 at 17:43
  • 1
    Because shapefiles have the same field than original file: <node id="32633413" visible="true" version="6" changeset="13406299" timestamp="2012-10-07T23:36:07Z" user="Davlak" uid="217070" lat="41.8994226" lon="12.4969449"/>. Column character isn't a field, is a tag, such like: <tag k="bus" v="yes"/> <tag k="highway" v="bus_stop"/> <tag k="internet_access" v="wlan"/> <tag k="internet_access:name" v="AtacWiFi"/> <tag k="internet_access:operator" v="RomaWireless"/> <tag k="name" v="Nazionale/Quattro Fontane"/> <tag k="operator" v="ATAC"/> ..., right? – aldo_tapia Nov 27 '16 at 21:27
  • 1
    Tags are like description on .kml files, in a field you can have a lot of tags, even .osm files have a similar structure than .kml. If you want to extract tags use osmosis, not GDAL to create new fields based on those tags. Are you trying to get something like this? – aldo_tapia Nov 27 '16 at 22:41
  • 1
    A field name can't hold colons. Solution: open your .osm file with any text editor and replace colons with underlines, save it and export to shapefile. .osm file is an XML, you can manage contents easily. – aldo_tapia Nov 29 '16 at 1:02
5

According to the same Esri article that you cite:

These limits are imposed so that ArcGIS is able to function with the maximum amount of data types.

Consequently, even if you are not prevented from using the colon in a field name by whatever software you are using to create shapefiles, you will be unwise to use them with ArcGIS.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.