Create and edit a shapefile in QGis

Using QGis to edit and create Esri ShapeFiles

Downloading some shapefiles

For this examples I’ll use some shapefiles of Romania, you can get them here. Scroll to the position shown in the image below and click the highlighted links to download the shapefiles. “Frontiera” means frontier, the file contains the outline of the country and “Judete” means counties, and contains the outlines of the counties of Romania.


Unzip them somewhere in a folder and start QGis.


Setting up Qgis

Go to Web > OpenLayers plugin > Google Maps > Google Satellite (don’t have this option? please see this link).


Wait for it some seconds/minutes and google earth map will load in the main window. If it doesn’t just scroll and move the mouse a bit or select other type such as Bing, OpenStreetMap etc. I panned just above Romania.

1.5Click Add Vector Layer on the left toolbar.


Select frontiera_ro.shp from the place you unzipped the downloaded files. Click Open.


Main window now looks like this:


The new pink layer, frontiera_ro, placed itself perfectly above Romania’s border and surface. This is because this shapefile’s coordinate system is WGS_84 (highlighted in the first picture). If you look at below picture the same coordinate system is used by QGis, but instead here is called EPSG:3857. They are one and the same thing, see more about this epsg here.

5Next, to the same thing and load judete_ro.shp. Your layers panel should look like this:


Some shapefiles have attributes (addition data they can hold). To view a shapefile’s attributes right click the layer and select Open Attribute Table.

7Here is the attribute table for judete_ro shapefile. It holds data regarding name of the county, population in different years etc.

8So we have the map of Romania, outline of it’s counties, let’s add the counties seats!

Click Layer > New > New Vector Layer. A layer can contain only one type, either point, line or polygon. So on the same layer you can’t have cities (points) and roads (lines). We also added two more attributes, name (String) and population (Integer) because we want to hold some extra data in each point. Click OK and it will ask you for a name to save the .shp file. I chose: “resedinte_de_judet” (it means county seats in romanian).


The layer panel should look like this:


To add points (features) on the layer we must click the Crayon icon in the toolbar which says “Toggle Editing”. Next click the Add Feature button. Now you are ready to click on the map and add features (points in this case).


Let’s deselect frontiera_ro and judete_ro and move resedinte_de_judet at the top if it isn’t already.


Also, let’s switch to the OpenStreetMap version because we can see the cities better.


You window should look like this by now:


Click on “Bucuresti” and input the following info:

15Then click OK. You will see a point (feature) has been added to the layer.


Do the same thing for some other cities and when you are done, go to the layers panel, right click on the layer and select “Save Layer Edits” so all the changes are saved to file.

17That’s it! You successfully created a shapefile using OpenStreetMap as reference! See in the next tutorial how can you load it in GeoServer and display it on the web!