Label Alice "The Snake Charmer"

By El-Noor Rashid, ArcView Developer, CGIS

| Contents Page | Al-Khabar Home Page | CGIS Home Page |

Being the new kid who had just transferred from the rival Fillmore Polytechnical didn't make Alice the most popular girl at ArcView High School. The late transfer meant she was behind the rest of the class who had just finished the primer on ArcView tables and were now working to complete the due assignment. Alice was led to her first period class and was introduced to her new classmates. She gave them all a warm, neighbourly smile, but her welcome was not equally friendly. You must understand that from softball games to software competitions Fillmore has always been regarded as the inferior opposition. Alice ignored their smirks and quickly sat down in the first empty seat available at the front of the class.

More then ever, she was determined to show them all what she could do and so she clicked confidently the ArcView icon (she knew at least that much). She was slightly amused by the school banner "ArcView GIS", appearing on the screen, but was surprised by the new interface with all its tools and buttons and drop-down menus and windows with more icons and buttons. The foreign face made her a little uneasy and she sought comfort at the console, but she couldn't find it! She min'ed and max'ed, opened and closed one window after another, but it was nowhere to be found and in frustration she raised her hands and exclaimed "Where's the command line?" The roar of laughter first started with the boys at the back, contagiously working its way around the room. Even the teacher was not immune as she kept shaking her head while trying to quiet the class. Normally, this would have driven an impressionable young girl, on her very first day, at a whole new school, to a monsoon of tears, but Alice was no ordinary girl and in her good-humoured spirit, instead, noted down the event for a potential blooper in the school yearbook. The teacher then took Alice aside and got her started on the ArcView tutorial. She galloped through the it like a racing-camel running in the equivalent of the Kentucky Derby and, when finished, immediately began the chapter on View documents. At the end of the class, she had impressively completed the first assignment and was ready to tackle tables. The teacher, choking on her Hungarian Goulash sandwich in sheer disbelief at what this little wonder had accomplished in so short a period , could only give a nod of approval. For Alice this was enough. Her first day and she had learned the school motto well: Point-Click-Drag.

The following days, the class continued to work on the ArcView table assignment. During this time, Alice was gradually accepted into the rank and file with the majority of the class, but she wanted to break away from this troop to join the academic elite. This being her aim, she eagerly led the attack on the assignment. The problem set was fairly routine: joining, editing, exporting and creating tables. One by one, she dutifully knocked off each question. But the last problem truly was a creature of a different sort.

The question read, "Label each Municipality of Qatar providing its Name on the first line of the label, the Area on the second line and the Population on the third line."

At first sight, the question seduces you with its simplicity, but its sounds of alarm immediately alert the senses to the true nature of this serpent.

Who among these young warriors had the courage to face this dragon? Alice glanced around the room. There were many brave knights who indeed took on this challenge, but their baffled expressions told a tale of defeat. Upon seeing this, it was clear to Alice that brute force was not the weapon with which to fight this beast. Alice reasoned that the answer to any problem lay in the problem itself. Therefore, she figured it was not a matter of slaying, but "charming the snake" for the solution. Armed with only self-assurance, Alice set off on her quest, whistling confidently along the way...

Alice was well aware that in ArcView, a geographic feature is labeled by selecting only one field from the Feature Attribute Table (FAT). Therefore, to label a feature with information from more than one field, as in her case, the chosen label field must contain the collective data from the other fields. She knew this could be done by first creating a new string field (this will be the label field) in the FAT, making the field active by clicking on it and then calculating the value of this field by concatenating data from the other fields: Name, Area and Population. Alice recalled from one of the previous exercises that the Calculate Button would allow her to enter such an expression to calculate the value for the label field: [Name] + " " + [Area].AsString + " " + [Population].AsString. When dealing with numbers, the plus request (+) adds numbers together, but when working with strings, this request concatenates or joins strings together. The AsString request converts a number to a string.

Because the Municipality theme could not be edited directly from within ArcView (it was not a shapefile, but an ARC/INFO layer), Alice had to first export the FAT as a dBASE file, add the file back as an ArcView table document, edit the table document as described above and finally join it back to the FAT using a unique identifier as the joining field. Since all of this was covered in the ArcView table primer, it did not take long before she began labeling the Municipalities. But as soon as she started, Alice realized she had been deceived by what she first thought was a simple problem: The labels each appeared as one line of text, not 3 distinct lines as the question had asked.

It was clear that Alice had been bitten and the poison from the bite was already beginning to drain her spirit. Somehow, however, she managed to gather her remaining strength to once more focus on the question.

Over and over again she chanted to herself, "Name on the first line, Area on the second line, Population on the third line." Slowly, the solution started to emerge and now she murmured to herself in almost a low hum, "Each unit of data must be separated by a newline." Suddenly, the answer became exposed. "That's it!," screamed Alice, but no one paid any attention to her. They had all heard the same brief trumpet of triumph before, only to be silenced by the fire-breathing one. This time, however, her hypnotic cry carried on. What Alice found out was that the data would have to be cleverly concatenated using ArcView's special newline (NL) string.

All sounds coming from the front of the room soon stopped and consequently, so did the mouse clicking. Alice politely waited until the teacher had finished her lunch before approaching with her solution. The teacher, completely overwhelmed, but now in full control of her vocal faculties, exclaimed, "You are a little wonder!" For the remainder of the year, Alice was hailed by her classmates as "Alice the wonder lass." But for a brief moment during the term you and I knew her as "The snake charmer."

| Contents Page | Al-Khabar Home Page | CGIS Home Page |