OpenStreetMap and GIS: Bridging the gap.

Many a times I have heard my GIS friends say that OpenStreetMaps are ‘just’ street maps and lack quality and ability to be used in efficient GIS applications. But this is not always true. I would like to make a comment that, GIS applications they mention still uses any kind of map data which are essentially gathered and processed through GPS or Satellite Images. OpenStreetMap is the culmination all of those sources.  People around the planet are contributing to OSM through satellite images, raw GPS data and geo-referenced cadastral maps. OpenStreetMap is thus a wonderful resource that can be used into GIS applications and more over it is free!

Now, let us see how this could be done at the first level. Probably most of the leading GIS softwares uses PostgreSQL database with PostGIS extension to process geographic information. This note would help you to download the OSM data of the region of your interest and create a PostgreSQL database with duly applied postgis extensions. The database would fit into any GIS requirement as you expect.

A word about OSM layering of data. In OSM there are no layers in the traditional GIS sense. All features are in one big coherent
database. But still, when you are creating a database out of it, you are actually layering the entire data. More information on layering is available here.

Lets us begin with collecting the OSM data. There are many ways for you to download the OSM data sets. I prefer those from CloudMade. There are other sources like GeoFabrik. And of course the direct data sets from OpenStreetMap.org. The data might be in the default OSM xml style sheet which is called the .osm file.

Now that we have the data, we’ll use some tools to set the database up. Please ensure that you have PostgreSQL, PostGIS including the contrib packages. Osm2pgsql is the important tool which we would be using to straight away convert the OSM data set into a PostgreSQL database.  You can install osm2pgsql from the source or packages listed here.

Next, we need to setup a database to load the OSM data. This could be done in the following steps.

  • $ sudo -u postgres createuser <username>
  • $ sudo -u postgres createdb -E UTF8 -O <username> <dbname>
  • $ sudo -u postgres createlang plpgsql <dbname>

Now add the postgis extensions. Note the location of the lwpostgis.sql file may vary.

  • $ sudo -u postgres psql -d <dbname> -f /usr/share/postgresql-8.3-postgis/lwpostgis.sql

Next give access to the user to update the postgis metatables.

  • $ sudo -u postgres psql -d <dbname> -c “ALTER TABLE geometry_columns OWNER TO <username>”
  • $ sudo -u postgres psql -d <dbname> -c “ALTER TABLE spatial_ref_sys  OWNER TO <username>”

Apply  900913 diff which is not normally included with postgis, you can get it from the source of osm2pgsql. To add it you should run:

  • $ sudo -u postgres psql -d <dbname> -f 900913.sql

Run, osm2pgsql, this should load the OSM data into the database we just created.

  • $ osm2pgsql <osm_file> -d <database_name> -U <user_name>

Now you can import the database into any GIS software.

For the completion of this document, I would illustrate usage of the database with qGIS. Start qGIS with a new project.

  • Click on the “Add a PostGIS layer” button on the toolbar.
  • In the “Add PostGIS Tables” pop up, click “new”.
qgis2
Click to enlarge
  • Fill in the fields accordingly and click “OK”.
  • Connect to the database and select the required tables to import.
qGIS
Click to enlarge
  • Click Add.
qgis3
Click to enlarge

Now we have the OSM data in the GIS software, just like any other geographic data source.

Hope this quick guide helps! Please let me know if you have any difficulties.

Fort Cochin Heritage Walk Mapping!

Fort Cochin is marked for one of the earliest establishments of foreign trade in Kerala. The heritage walk is an awesome 6 KM journey on foot, which takes us back to the 1700’s when the Dutch, the Portuguese and the English was busy trading the wealth. The island provided them a very wonderful place to trade and refresh. The heritage walk meets us at different monuments which reminds us of these historical landmarks.

I met Arky at the Ernakulam Boat Jetty, from where we collected few maps and other resources. We took a boat ride to Fort Cochin. The boat journey was refreshing for as I did not have anything for my breakfast. We planned how to get the things done.

IMG_9953
The Boat Ride
The Boat Ride
The Boat Ride

We refined the list of POI’s. The boat took us to Fort Cochin in 25 minutes. It was around 10.20 AM. Pinged Sameer of i-lug cochin and Prinson of SPACE. Prinson promised to join us soon with the wireless internet device. But, we could not wait, and started mapping right from the point where we got down. It took us a moment to set up the GPS device, the notepad and our Camera. I was tweeting all the way.

We started our walk by watching the beautiful Chinese fishing nets.

Chinese fishing nets
Chinese fishing nets

We decided to take photographs in such a way that we could properly geotag them.

On the left, we found the Nehru Childrens’ Park. We sat down there for a moment and verified our route in the map we obtained.

Nehru Park
Nehru Park

We took the walk on to the paved retaining wall, and found the third POI, the Great Anchor

Anchor
Anchor

This was one of the four anchors used by Lord Wellingdon.

We continued our walk through the pavements and came across the Steam Boilers.

Steam Boilers
Steam Boilers

These were used by the cranes. Coke and Coal was the important fuels of the boilers.

On the right we found few rest shelters.

Shelters
Shelters

We held back at the shade of a tree to watch a beautiful yacht moving the back water. Arky was exclaiming his dream to spend a day in such a yacht.

Yatch
Yacht

We came across the remains of the Fort Immanuel, the Gunnary.

Gunnary
Gunnary

This was used to fire at any illegal boats or yachts found in the waters.

There were two look out points or view points leading to the waters. Somebody can walk upto it and enjoy the fishermen making their life.

I could not resist to jump into the sea side beach. The climate was very hot and dry.

Beach
Beach

Still we enjoyed the walk and with sheer enthusiasm, decided to continue.

We took a deviation from the paved way into the Dutch Cemetery Road.

Cemetery
Cemetery
Inside
Inside

It dragged us back to the times, the Dutch established their colony in Fort Cochin.

Next, we came across the Thakur House.

Thakur House
Thakur House

Thakur was one of the earliest North Indian who settled down in Fort Cochin for Trade purposes. This is the place where he lived.

We took a left to the Napier Street

Napier Street
Napier Street

And found the St. Andrews Parish Hall.

St. Andrews Parish Hall
St. Andrews Parish Hall

Looking on the watch, we realized that we walked for half an hour. And, yet, we enjoyed. I was getting the feel of hunger.

ATM
ATM

Since our plan is create a tourist friendly map, we were focussing on places like this too.

Bishops House
Bishops House

The Bishops house was near by.

Indo-Portuguese Museum
Indo-Portuguese Museum

It was a lucky find. The museum is located inside the campus of Bishops House. But unfortunately, we could not sneak in as it remains closed on Mondays.

Now, we checked the data so far we have collected and correlated them with the pamphlet we obtained. Almost done. Few more to go, and continued walking.

VOC Gate
VOC Gate

This was really interesting. The VOC gate. The Dutch establishment in Fort Cochin was like a colony. There were many gates for the fort or whatever they call it. This was the main entrance gate, built in 1740.

Vasco House
Vasco House

We came across the Vasco House and ..

Vasco Cafe
Vasco Cafe

We walked across the street to find the St. Francis Church.

IMG_0024

We sneaked into the church, a lot of people were offering their humble prayers.

IMG_0025

Inside the church we found these large sheet hanging from the roof top. Arky reminded that they are the fans and we talked a bit about the slaves who sat outside the church and pulled the rope to wave the sheets. This was serving as a fan.

The next find was the Santa Cruz Basilica.

IMG_0035

There were a lot of believers flowing into the basilica.

We collected the required points and photographs and continued walking, and Arky pulled my attention to this one.

IMG_0038

We watched the love birds chirping as we walked past the street.

Koder House
Koder House

We came across the Koder House. Guess we missed the Delta Study, Arky verified the resource maps and confirmed we had to trace back.

Delta Study
Delta Study

Not too far. We found it. Recorded the POI.

We took the street across the Koder house again and reached the Vasco da Gama Square near the Nehru Park. This is the place where we had begun the walk. And back to square one. We had some tender coconut juice, and verified the waypoint data we collected. It was amazing for us.

The Device
The Device

Prinson popped in. We together walked to Vimal’s bookshop in the Prince Street. Sat down there for a moment and downloaded the data.

Vimal's Shop
Vimal's Shop

To our surprise, we have collected a lot of data in very short time. Prinson reminded that there is a harthal tomorrow. Vimal tried to arrange us a stay, but this season, it was very difficult.

So we decided to wrap it up and move to the Regional Centre of SPACE at Kalamasery. We met Sameer of i-lug Cochin there.

Tagging in JOSM
Tagging in JOSM

The walk was tagged and uploaded to OpenStreetMap. This was one of the projects by Geohackers. The event was a get-away for me, Arky and Prinson. We learned to improve the quality of map making process.

The next step is to create a tourist friendly map. This is the important part. It is great that we have Hiran to help on creating the overlay.

Will update once it is complete.

Mapping Party – How To

We had a very good experience learning more about OpenStreetMap and Mapping, through the NIT-C Mapping Party. Since then, we have been collaborating a google doc, to document the event. The How-to document is thus a part of the entire event, the geohackers initiative.

Introduction


Map-making or Cartography aided mankind from the time when lived in caves, the geographic knowledge and the compass guided the progess of our civilization. Today such wealth is only available to those who can pay huge royalties or license fees. OpenStreetMap project (OSM) takes its inspiration from Free Culture philosophy and aims to provide geographic information of the entire planet to one and all.
Mapping parties are organized to teach map making skills and contribute to OpenStreetMap project. With the advent of GPS technology anyone with such a device and computer can build high quality maps. This document explains how one can organize a mapping party in their school or workplace.

The Tools


Lets look the tools that are needed for making maps, we need a GPS devices, a personal computer to edit the mapping data and a account on OpenStreetMap servers to upload your data.

GPS device


GPS is Global Positioning System. The earth is surrounded by 31 satellites, which provide us sufficient information to identify where we are on the planet. This tracking is processed with the help of geographic coordinates called Latitudes and Longitudes. There are lot of stand alone GPS receivers available in the market. At the mean time, most of the smart phones are equipped with GPS receivers. GPS devices are the primary data collection tool for mapping.

The data collected in the GPS devices are used in the GPX format. This is the most easy and efficient method for fetching the data from the device. The GPX file is the collection of traces and waypoints. Map images in formats like .jpg, .png etc are also used. The OSM data subsets are available in the .osm format.

Editor



Map editors are the workplace were we use the data collected from GPS to create the map. Creating the map involves proper tagging of the data. Many editors are available, like Java OpenStreetMap editor (JOSM), Potlatch, Merkaartor. Among these, JOSM is the heavy duty offline editor.

Getting an OSM account


We need to have a proper OSM account to validate and upload the map we created. You can create a new here.

Lets start mapping !


The next important step is creating teams. The entire party is divided into small teams based on how many GPS devices you have at your disposal and size of mapping area. Each team should have at least one person with good sense of direction. Each team can be given a name or colored arm band (optional). Each team is equiped with a terrian map with landmarks that show the borders of their sector. Various services like google, yahoo. walking-papers.org provide terrian maps that can be printed before hand. A person can act as a control center co-ordinator. He is responsible to staying in touch with team in the field with mobile phone or portable 2 way radio (optional)

Data Collection and Downloading


Maps are created at this stage. The data we have mined are ordered, analyzed, and tagged. We need to make sure that all the team follows a naming convention or comment. The coordinator should watch for over marketing / mis-marketing of the same location. Once the data is properly tagged, it is time to upload it to the OSM server.

Feedback


Each team would be provided with a feedback form, which they are intended to provide sincere information regarding their experience in the workshop. This step is a sort of improvement and corrective measure for the GeoHackers team.