Batch-Loading and Merging Shape Files Into PostGIS

Today I was faced with the task of having to load a massive amount of shape files into my PostGIS database. The data in question is the Advanced Digital Road Map Database (ADF) (拡張版全国デジタル道路地図データベース) by Sumitomo Electric System Solutions Co., Ltd. (住友電工システムソリューション株式会社). It contains very detailed information (spatial and attributive) about the road network of all Japan and is thereby quite heavy.

Therefore, it was split into a plethora of files using the following naming schema: mmmmmm_ttt.shp, where mmmmmm represents a six-digit mesh code and ttt represents a 2- to 3-digit thematic code. The mesh code is a result of the data being split spatially into small, rectangular chunks. It follows a simple logic, whereby bigger mesh units (represented by the first four digits) are further subdivided into smaller units (represented by the last two digits). It took only a small amount of time to figure out this naming schema and filter the files that would be necessary for my analysis.

Basically I wanted to merge the shape files into PostGIS tables divided by their topic (i.e. road nodes, road links, additional attribute information, etc.). So I had to find a way to batch import the shape files into PostGIS and merge them at the same time. Yet, since the node IDs were only unique within each mesh unit (i.e. shape file), I also had to find a way to incorporate the mesh codes themselves into the data, so I could later on create my own ID schema for the nodes, based on the mesh code and the original node ID (e.g. mmmmmmnnnnn, where mmmmmm represents a six-digit mesh code and nnnnn represents the original 5-digit node ID).

Continue reading →

Working With Non-Unicode Data in Python

Being a researcher in Japan means I often have to work with Japanese data. While generally data is data is data, there are some peculiarities I came across that seem to be related to the fact that those data are about and produced in Japan.

Firstly there is the way they are delivered. I’m no so much talking about deliveries on “hard media” such as CD-ROMs and DVDs being snail-mailed, even though this seems to be the major way of obtaining data until this day. Luckily I’m embedded in an ecosystem of research institutions and university laboratories that engage in joint research projects and thereby share the necessary datasets online using portal websites. I’d especially like to mention the JoRAS portal of the Center for Spatial Information Science (CSIS) at the University of Tokyo (東京大学) here, since their stock is quite extensive and they are always open for collaboration inquiries.

Secondly there is the fact that, not very surprising, Japanese datasets often contains Japanese data. By this I’m not referring to the fact that this data is dealing with information about Japan, but to the fact that it is making use of Japanese script. This introduces some technical difficulties, which I would like to elucidate in this article.

Continue reading →

Upcoming Event: 5th Annual Meeting of the Japan Association on Geographical Space (JAGS)

I am very pleased to announce that I will be presenting about my ongoing research about Spatial Terrorism Vulnerability Analysis at the 5th Annual Meeting of the Japan Association on Geographical Space (JAGS) on Saturday, June 30th 2012. The conference will be held at the Tōkyō Campus of Tsukuba University. The location is Ōtsuka 3-29-1, Bunkyo, Tōkyō (東京都文京区大塚3-29-1). For further details please refer to the conference website (in Japanese). This is a great opportunity to introduce my research to an (almost) exclusively Japanese audience.

Wrap-up: 2012 Annual Meeting of the Association of American Geographers (AAG)

From February 24th to 28th the 2012 Annual Meeting of the American Association of Geographers (AAG) was held in New York City, NY. Due to the large number of participants (~8,600) and sessions offered (~3,500) the conference was held in both the Hilton New York and the Sheraton New York Hotel & Towers. The conference ended more than one month ago, but unfortunately I haven’t been able to write down my comments about it earlier.

I have been trying to attend as many sessions as possible, and after detailed preparation have been able to attend a session in every time slot offered, except during the two field trips I participated in. Furthermore, I presented my own research in one session.

This is a summary of the sessions I attended and the most interesting papers and topics covered there. (The numbers in brackets refer to the session IDs in the conference program.)

Continue reading →

Upcoming Event: 2012 Annual Meeting of the Association of American Geographers (AAG)

From February 24th to 28th, 2012, the Association of American Geographers (AAG) is inviting everybody interested to its 2012 Annual Meeting to New York City. This will be a great opportunity to hear about (and see in action) the latest trends and ideas in geography, GIS, and spatial analysis in more than 4,000 paper and poster presentations as well as several workshops and field trips.

I, too, will be involved in a so-called Interactive Short Paper Session titled “Highlights in Spatial Analysis and Modelling”, where I will give a brief 5 minute overview of my current research in a slot titled “Spatial Analysis of Terrorism Vulnerability”, followed by a panel discussion together with the other seven presenters of this session. The session will be held on Sunday, February 26th, from 8:00 AM to 9:40 AM in a room called Sutton Parlor Center on the 2nd floor of the Hilton New York, one of the two conference venues.

Continue reading →