SQL Server – Learning Spatial stuff – Understanding and exploring Shapefiles using Map Browser

Hi Friends,

In one of my recent trainings, I was demonstrating the map control of Reporting Services R2 to a set of audience who were new to spatial data. I spent an hour demonstrating all the basics of spatial data before moving on to Reporting Services Map control. Thus, I decided to the same on my blog here. I shall write a series of posts related to spatial stuff, including the Map control in SSRS R2.

But let us first being with some basics:

What is a shape file?

A shapefile is a geospatial vector data format for geographic information systems software. It is an open specification developed and regulated by ESRI. ESRI stands for Environmental Systems Research Institute. It’s a software company based in California and has many popular products for GIS software market. You can visit to know more.

Shapefiles spatially describe geometries like points, polylines, and polygons. These, for example, could represent water wells, rivers, and lakes, respectively. Using these shapfiles, you can describe political boundaries, mountains, etc.

Its a digital vector storage format for storing geometric location and associated information. The shapefile format was introduced in early 90s. Today, you can read and write shapefiles using a number of free and commercial tools.

While we say “shapefile” and it sound like a single file, it actually comprises of several files. Three files are mandatory to store the core data that comprises a shapefile: “.shp”, “.shx”, “.dbf”. The actual shapefile relates to “.shp” extension, but alone is incomplete and the other supporting files are required.

Mandatory files :

.shp — shape format; the feature geometry itself

.shx — shape index format; a positional index of the feature geometry to allow seeking forwards and backwards quickly

.dbf — attribute format; columnar attributes for each shape, in dBase IV format

Here is a whitepaper from ESRI that you can read to know more about the shapefile;

Today, many government institutions and even companies provide free shape files for commercial and non-commercial use. Some companies provide shape files for a price. It is all about the accuracy of data. And I am sure you understand what I mean.

Downloading free shape files:

Now, the first thing you would like to do is download some shape files and browse them using a free tool. We shall talk about importing the shape files in SQL Server in my next post.

VDS technologies is a good source to download some free shape files;

Another source is http://www.diva-gis.org/gdata

Some time back I had downloaded the world.shp file from VDS website, but am now not able to locate that file, instead I see country specific data. May be, you can look around to find that shape file.

So the first step is to download the shape file. The second step is to download a free tool to browse the shape file and you can use the Map Browser by VDS;

The third step is to install the map browser and fourth step is to browse the shape file using the tool 🙂

Here is what I did. Download the US states shape file: http://www.vdstech.com/mapdata/usstates.zip and the map browser.

1_SQL_Server_Learning_Spatial_stuff_Understanding_exploring_Shapefiles_using_Map_Browser

Extract the usstates.zip and Install the map browser by executing MapBrowser.exe. After installation, run it.

   

2_SQL_Server_Learning_Spatial_stuff_Understanding_exploring_Shapefiles_using_Map_Browser

In the Open a File dialog box, double click on More Files… and navigate to the folder where you have extracted the contents of usstates.zip

3_SQL_Server_Learning_Spatial_stuff_Understanding_exploring_Shapefiles_using_Map_Browser

And select usa_st.shp file. Click Open.

4_SQL_Server_Learning_Spatial_stuff_Understanding_exploring_Shapefiles_using_Map_Browser

That’s it and here you go.

5_SQL_Server_Learning_Spatial_stuff_Understanding_exploring_Shapefiles_using_Map_Browser

You should definitely maximize the window to explore things in greater detail. Have a look at the enormous amount of data in the grid and observe the attributes. These are wonderful statistics. Explore the tool and the data, there is a lot we can do with this and I am sure you are already thinking about that 🙂

That’s it friends, for this post. In my next post I will show you, how you can import the same US states data, that you are browsing, in SQL Server database.

Stay tuned.

 

 

   

About Amit Bansal

Amit Bansal is always brainstorming around SQL Server. Despite working with SQL since 1997, he is amazed that he keeps learning new things every single day. SQL Server is AB's first love, and his wife does not mind that. He tries to share as much and spreads the SQL goodness. Internals and Performance Tuning excites him, and also gives him sleepless nights at times, simply because he is not a genius, but quite a hard worker and does not give up. It has been a long and exciting journey since 1997, you can read here: http://sqlmaestros.com/amit-bansal/ He is on Twitter: https://www.twitter.com/A_Bansal

View all posts by Amit Bansal →

Leave a Reply

Your email address will not be published.