-
Notifications
You must be signed in to change notification settings - Fork 5
6b Prepare your data
Now we are going to work with real-world data. For the tutorial i'm using some free world country boundaries together with population and area to create a thematic map.
A good commercial resource for spatial data is PTV Logistics. They provide both geography and the corresponding socio-economic data. But you could also use the geometries and link it to your own data.
To visualize the spatial data, we have to import it into our database. The de-facto standard for exchanging geographic data are Shape Files (.shp). First we have to find a way to import them into our database. It is also possible to work on shape files directly, see https://github.com/ptv-logistics/SharpMap.Widgets, but there are many advantages having the geo data right in our database.
This little console application reads the shape file and writes the data into SpatialLite. I'm using SharpMap as 3rd-party library here, because it can handle shape files. After the import i can directly work with the spatial database via ADO.NET, so i don't need SharpMap there.
The code creates a db.sqlite database. We can open it with any SQLite tool and make queries on the data.
For our program we just copy it to our web project.