Friday, December 4, 2015

Mapping in Thailand — Trees and other things

I'm so caught up in mapping that it affects everything I do — it's a major force in my life. It's an addiction, an obsession. It also gives me great joy and lends a purpose to my days other than merely wondering how much time I have left on this planet. Unfortunately, at my age one's thoughts tend to turn in that direction all too often. Mapping focuses my thoughts in a much more positive way. I'm learning about something that has fascinated me forever, the visual representation of geographical features on paper or a computer screen. The desire to talk about mapping has now brought me full circle, so to speak, and motivated me to write a long overdue blog post.

I'd rather not divulge, or perhaps confess is a better word, the exact number of hours I spend at the computer on Open Street Map (OSM) projects but most days it's like a fulltime job. I'll sit down at my desk first thing in the morning, usually at about 6 am, with a cup of coffee beside me to check my email and before I know it I'll be adding some details to OSM or planning a moto ride to check out an area I'm curious about but haven't seen in person. I used to write in this blog more often but I just don't seem to have the time anymore. Ridiculous, I know. Those of you still working know how precious personal time is and you might think a retiree has nothing but time on his hands. But between tennis, a relationship, motorcycling and mapping I manage to keep myself quite busy all day, every day.

A short while ago I got an email from an OSM mapper in Belgium. He asked if he could interview me for a "Mapper in the Spotlight" series started by the OSM Community in Belgium a couple of years ago, the idea being to get to know one another so as to become more of a community. He only knows me from some posts I made on OSM's Tagging listserv, which is a mailing list where participants discuss how to tag (or otherwise characterise) mapped objects for the OSM database. I felt honored and responded right away. Marc sent a list of questions that I answered and which he incorporated into his blog. Answering his questions in my own words constituted the "interview" and I suppose that's the best sort of interview one could hope for, i.e., one you write by yourself about yourself. If you want to read it you can find it here.


Yang na trees lining the busy Chiang Mai-Lamphun Road (Nong Hoi)
The tree mapping project I touched on in that interview is what I'm working on lately. Nut and I moved to Nong Hoi last spring. Our new neighborhood is on the south side of Chiang Mai and after discovering the good coffee shops and restaurants nearby, we've come to really like it. I have been fascinated by the magnificent and stately Yang na trees lining the Chiang Mai-Lamphun Highway through Nong Hoi (Route 106) since I first saw them several years ago. Their scientific name is Dipterocarpus alatus and they're related to rubber trees. Thais call them "ton yang na" (ton = tree). These splendid trees have an interesting history. They were planted in 1882 by order of King Rama V when the Chiang Mai-Lamphun road was but an ox cart. Residents living along the track were delegated to care for them by supplying water and fertilizer. You can read more about how they came to be in this short article. The shade they provide on the now very busy thoroughfare is wonderfully cool and reminds me of the elm tree "tunnels" that once adorned most of the streets in my hometown of Buffalo, NY. Buffalo's elm trees are long gone, killed by the Dutch Elm Disease that ravaged the U.S. back in the 70s. These trees might disappear someday as well but for a different reason: traffic and pavement have stifled their growth and made them vulnerable to disease. Dipterocarpus alatus is now considered an endangered species in its original habitat (see this Wikipedia article), and many of the Nong Hoi trees are either gone or in poor health. You can tell by the ribbons of gold cloth tied around each trunk that the Thai people revere them. Yet despite that concern pavement continues to encroach and their overall health continues to decline.

Yang na trees - morning - Nong Hoi
A healthy, open grown Yang na - Nong Hoi

I'm planning to enter data for each local Yang na tree into OSM. I will locate them positionally by using a combination of GPS data and spatial observations from the ground. Almost every tree has a tag with a number on it. I'm not sure which Thai government agency maintains these records, or if any do, but I'll enter that number in the ref tag when available. I measured the height of some of the ones closest to my home using an iPhone app called Theodolite which does the same thing as the theodolite instrument used by surveyors, which is to measure angles. It's not nearly as accurate as those precision instruments but is, as we say, "close enough for guv'mnt work" and just the ticket for my needs.

Theodolite (v5.0) screen on iPhone 5
In practice you can use simple trigonometry to calculate the height of the side of a right triangle given the length of one side and the angle between them. The trick is in measuring the angle. Theodolite makes that easy. I paced off a distance from the base of a tree and then sighted back toward it using the crosshair to mark A and B readings at its base and top; Theodolite then calculates a height. Since all these trees were planted at the same time most are roughly the same height, which is about 40-45 meters (~150 feet). It's not my goal to measure the height of each and every one of perhaps a hundred trees still standing but over the next few months maybe I'll get most of them positioned.

I've created a helper tool to make entering this information into OSM easier. JOSM is the most powerful editing program available for working with OSM and it's the one I use. It allows one to develop shortcuts called presets that facilitate entering data speedily, and consistently. Here's the one I'm using for the Yang na trees:

<item name="Tree: Yang na" type="node">
          <label text="Tag a Yang na tree node"/>
          <space />
          <key key="natural" value="tree" />
          <key key="leaf_type" value="broadleaved" />
          <key key="leaf_cycle" value="evergreen" />
          <key key="species" value="Dipterocarpus alatus" />
          <key key="species:en" value="Yang na" />
          <key key="species:th" value="ยางนา" />
          <key key="species:wikidata" value="Q140957" />
          <key key="wikipedia"  value="en:Dipterocarpus_alatus" />
          <space />
          <text key="height" text="Height (m)" default="" delete_if_empty="true"  />
          <text key="circumference" text="Trunk Circ. (m)" default="" delete_if_empty="true"  />
          <text key="height_trunk" text="Bole Height (m)" default="" delete_if_empty="true"  />
          <text key="diameter_crown" text="Crown Diam. (m)" default="" delete_if_empty="true"  />
          <text key="ref" text="Ref #" default="" delete_if_empty="true"  />
          <space />
          <text key="note" text="Note" default="" delete_if_empty="true"  />
          <space />
          <text key="name" text="Name" default="" delete_if_empty="true"  />
          <text key="name:en" text="Name:en" default="" delete_if_empty="true"  />
          <text key="name:th" text="Name:th" default="" delete_if_empty="true"  />
</item>

Using a preset makes it easy to remember exactly which tags are necessary to fully characterize the trees; it includes the scientific or Latin name, common names in both Thai and English along with the physical measurement data and saves me having to enter each tag manually. I've included tags with links to a Wikipedia article and the Wikidata entry. The code above produces the dialog box at the left (see below). After filling in the physical data and clicking Apply Preset, JOSM's Tags/Memberships Window (on the right) shows the relevant tags which are now ready to be saved and uploaded.

Applying the Yang na preset in JOSM
Another part of the project that is of primary importance to me is that I want to see "my trees" on a map. Someday OSM will be available in 3D and then the heights and crown diameters I'm entering will be used by rendering software to create pretty visual representations of them. But I don't want to wait for that to happen. The map you see on the main OSM page for this area has little icons for many common POIs (Points Of Interest): restaurants, hotels, bus stops, traffic signals, but doesn't show some of my favorite mappable items: trees, milestones, towers, and motorcycle fueling stations, to name only a few. (See my previous post Mapping in Thailand for more about my milestone fetish.)

That's why I began creating my own map icons that will display on my Garmin GPS and in Garmin's Basecamp program. For me, seeing the POIs I've entered on a map is one major payoff for the work I've done entering the data in the first place. I can also customise the colors and appearance of highways, woods and landuse polygons, and decide which POIs I want to see. I might not be interested in seeing hairdressing shops or veterinary offices visually but I definitely want to know if there is a nearby shop selling motorcycle fuel by the liter if I run low while riding out in the boonies. These small "bike petrol" shops are very common in rural Thailand where motorcycle travel is the norm.

Fuel stations suitable for motorcycles. A "Drummed Fuel" station and a vending-machine fuel station

In fact, distinguishing a small shop selling fuel hand-pumped out of a large drum from normal full-service fuel stations was one of my main motivations for making my own maps and customizing them for my needs. To the OSM community both are "amenities", places to buy motor fuel. But personally I would not want to drive to a place that's hand pumping fuel by the liter if I need a tank of fuel for an SUV. I designed a unique icon for my GPS that enables me to tell at a glance which type of fuel station it is.

Another type of fuel station that's become increasingly common in rural Thailand are vending machines that accept paper currency in exchange for a metered quantity of fuel. I'm betting these shops will eventually replace the drummed fuel shops. I made an icon for those too, one of which is visible at upper right in the above Garmin Basecamp screenshot.

Getting back to trees, I've designed some icons to represent them as well. They need tweaking but they'll do for now. My plan is to use several different sized icons to represent trees that are especially broad or tall. Tests can be made during the map compilation process to determine sizes just as species is determined now. Another favorite tree, common here and appreciated because of the shade its huge leafy crown offers, is the Rain tree. Its scientific name is Albizia saman. Thais call it Ton Chamcha (ฉำฉา). This tree has a shape something like an umbrella and they are literally everywhere. I have a preset similar to the one for Yang na that applies a set of tags specific to this tree. I also have presets for teak (Thai: ton sak) and Bodhi or Buddha trees (Thai: ton pho), both are fairly common and both have special significance in SE Asia.

Chamcha tree
Below is a screenshot of an area in my neighborhood where Yang na trees line the Chiang Mai-Lamphun Road. This image is also taken from the Garmin Basecamp program and displays almost identically on the screen of my Garmin Montana GPS receiver mounted on my motorcycle handlebar.

Garmin Montana Screenshot Chiangmai-Lamphun Road - Nong Hoi
I add this last photo just to show that not all trees in my neighborhood are big or magnificent. Here is a shot of the little papaya tree that was only a stick when we moved here last March. In just 9 months it gained substantial height and its trunk is about 5" in diameter. As you can see it also has fruit almost ready for harvest. Nut's excited because she loves papaya and to get them for free is extra special.

Our papaya tree

Stay tuned and thanks for reading.


Extras:
I was reading the OSM blog today, Christmas Day, and it contained a note concerning node #1, that is, the OSM object with an id of 1. It turns out that this particular node happens to mark a tree, and in addition that tree happens to grow in Passau, Germany, a town I visited a couple of years ago. It was my debarkation point for a 6-day bicycle trip along the Danube. How's that for coincidence?

The tree is located here: (48.566985, 13.4465242)