Author Topic: I cannot import some fields of my shapefile - they are always blank  (Read 1071 times)

roger

  • Administrator
  • Full Member
  • *****
  • Posts: 156
This is caused by an issue with data 'conversion'.  Computers can store data in many different ways: to be able to import it into NoiseMap, each field (i.e. column) of data must be store in a particular way.  NoiseMap uses one of three ways to store each field.  These are:
  • integer - this is always a 'whole number' and is used for numbering items of data and where a parameter can be one of a limited number of values, such as absorbent or non-absorbent barrier;
  • float - this is used for a value, such as the height of a ground contour, which can be of any size and often has a fractional part;
  • character string - this is a string of printable characters used for describing things.  This can include numbers (such as a house number) but it is not a numerical value.  The house number 31, for example, does not necessarily mean that it is the thirty-first house in the street, it is just a label.

Very often, when you print a set of data, you have no idea what internal format the computer is using to store the information as it will be converted to printable characters before it can be shown on your screen or printer.

In the present case, the problem is caused because you want to import a column of data (a field), which has been stored by your GIS as an integer number, into the description field of the object, for which NoiseMap requires a character string.  Unfortunately, NoiseMap doesn't convert data from one format into another, and since it can't read integer numbers as if they are characters, it ignores the problem and leave the field blank. It doesn't report the problem either. 

The same problem would occur if you try to read a number stored in numerical format as if it were a character string.  However, it may be able to read integers as if they are floating point, although it would not normally read a floating point number as if it were an integer. 

For safety, you must always ensure that your Shapefile attribute data is in the format that NoiseMap requires - as listed in Chapter 21 of the User Manual. 

How can you do this?
The 'attribute' data of a Shapefile is stored in the database component (file type .dbf).  You can open this in Excel.  It will appear as an ordinary spreadsheet with column headings and columns of numbers. It will be obvious if a column contains non-numerical values that this is Character format. But if it contains numbers, you can't tell because Excel does its best to put them into printable character format on-screen.  There is quite an easy way to tell, though, if you open the dbf file in Notepad.  You will see the column headings as the first line of the file.  Each heading is followed by a letter N, F or C.  These stand for integer number, floating point number and character. 

If you open the file in Excel, you can convert any number to character format by using the formula =TEXT(A2,"#") This says, take the contents of cell A2 and convert it into a number in character format.  The "#" just tells Excel to display the number in general number format.  You can use different formats in place of the "#" to get the number displayed with different numbers of decimal places, etc. 

A small glitch is that although you can open dbf files in Excel, Microsoft has removed the ability to save files back into dbf format. You can buy add-ins to restore this ability.
Alternatively, go back to the GIS and export the field in the correct format.