Working with Open Street Map
←
→
Page content transcription
If your browser does not render page correctly, please read the page content below
Working with Open Street Map Z Technology Application Note No: 32 Date: November 2012 Background Shapefiles are used by Z Technology DriveTest software for generating country and regional maps including roads, highways and other geographic features. For a detailed description of shapefile structure and usage within this software, see the DriveTest User Manual Appendix titled Third Party ESRI Map Data. This document discusses resources for creating free (open source) map data which can be used by DriveTest. Open Street Maps Open Street Maps is an initiative created by volunteers to provide free geographic map data such as street maps to anyone. The website is www.osm.org OpenStreetMaps map data can be provided in commonly used standards including one called Shapefiles. Shapefiles were first developed by the company ESRI. Z Technology, Inc. DriveTest Software uses map data in Shapefile format for generating maps within DriveTest Software. Shapefiles are actually a grouping of several files formatted to represent different aspects of geodata. Useful files within this grouping end in these file extensions: .shp .shx .dbf Free and open pre-made shapefiles are available at various websites including these: http://downloads.cloudmade.com/ http://download.geofabrik.de/openstreetmap/ Once shapefiles are downloaded, you may notice they are large files and contain significant amounts of data. This usually includes major country roads and highway along with a considerable amount of less useful map data. Fortunately, it is possible to modify these downloaded files for display of only desired map details by using free GIS software tools. One such tool comes from an organization called Quantum GIS. They offer a free user friendly Open Source Geographic Information System (GIS) application called QGIS. QGIS will allow the user to open & view shapefiles, modify them and save newly created set of shapefiles. The stand alone Windows QGIS tool can be downloaded from this website: http://www.qgis.org/ Modifying Shapefiles
Drive Test Application Note We will now describe the step by step process to modify shapefiles using the QGIS Windows based software. As an example, we will use open source shapefiles for Taiwan. To start this process, go to http://downloads.cloudmade.com/ and select Asia. Next select Eastern Asia and finally select Taiwan. Here you will see a link to download taiwan.shapefiles.zip. After downloading, extracting and viewing these files note there are four (4) shapefiles with the word highway included in the file name. We will be working with these files. They are: taiwan_highway.dbf taiwan_highway.prg taiwan_highway.shp taiwan_highway.shx Open the Quantum GIS tool. Go to the Layer Tab and select Add Vector Layer. Browse to the location where the taiwan_highway.shp file is stored and open the file. 2
Drive Test Application Note Right click on the Layer readout of taiwan_highway on the left side of the screen. Select Query... double click on TYPE in the Fields window and select All under the Values window. Using the operations section of this tool, create SQL clauses similar to the ones shown in this screen capture. QUERY BUILDER SCREEN Select Test at the bottom of the screen to review the number of features that will be selected by your next step. Finally select OK. This process allows a reduced 3
Drive Test Application Note number of features to be stored and used for a map which can be imported into DriveTest Software. In this case there are 3802 features selected out of more than 35,000. We narrowed the Values of interest down to just these three: motorway, motorway_link and primary. This will provide a reasonable display of country level roads as DriveTest software zooms and displays mapdata at the country level. As indicated above, after selecting OK, you will be directed back to the home screen for the QGIS application. Right click on the Layers window and the line labeled taiwan_highway. Select Save as.... and save the new shapefile data in a folder where you can retrieve the five shapefiles that will be created with this Save as… step. These shapefiles can now be used in DriveTest to generate primary roads and motorways within the map of Taiwan. QUANTUM GIS HOME SCREEN Creating Boundary Shapefiles manually At times it is helpful to create territorial or boarder shapefiles. These can then be used as Region Polygon Shapefiles for governmental or territorial subsections within a country. Simple Region Polygon Shapefiles can be created using the QGIS application as follows. 4
Drive Test Application Note On the QGIS software home screen select the New Shape File icon at the upper center of the screen. A new window will appear. Within this window the user is given three choices for TYPE of file to be created. Using the proper radio button, select Polygon. Next the user is asked to generate a Name under which the new file will be stored. After creating the Name, click OK. This redirects you back to the QGIS home screen. Now a new boundary can be creating using the Toggle Editing Tool and the Add Features Tool . Using your computer mouse, click around the edges of the displayed roads to create a polygon boundary encompassing the roads. Upon completing the process of generating a desired Region shape polygon, save your work by right clicking on the new file Name that appears in the Layers section at the left side of the screen. Select Stop Editing a message box appears named Save changes to layer . . . ? select Save. This process has generated a set of Polygon Shapefiles for use as a Region in the Map Data for DriveTest software. Creating Country Boundaries from downloaded mapdata The country boundaries native to DriveTest are very coarse. You may find that your new mapdata shows roads that go outside the DriveTest native country boundaries, if the country boundary boarders against a body of water you may see roads going into the water. You can fix this by creating a new country boundary layer with your more finely resolved open street mapdata. Using the Manage Plugins menu within QGIS, install the fTools plug-in for Vector data analysis and management. This will install a Vector menu selection on the toolbar of QGIS. To create a country boundary file one needs to produce Polygon type Shapefiles. If a Polygon file is not available, it can be created from Line type Shapefiles. To do this, first open the Line file with QGIS. This is done using the “Add Vector Layer” icon at the middle top of the QGIS home screen. Perhaps the Line file will have a name ending in something like ---coastline.shp. The name of the open file will appear in the Layer area on left side of the home screen. Go to Edit Mode and select the features making up the boundary of interest using the “Select Feature by Rectangle” tool . Next use the “Merge Selected Features” tool to produce one (1) and only (1) line feature for the next step. This step is required since most reasonable size Line Shapefiles are made up of multiple line features. 5
Drive Test Application Note To complete the process, go to the new Vector Selection menu on the Toolbar. This has appeared on the Toolbar from the first step discussed above in the section of this document. Move down to the “Geometry Tools” submenu and select “Lines to Polygon.” A Window will appear where you can select the “output polygon shapefile” name. This is done by Browsing to a folder you must prepare in advance. (i.e. use Windows Explore for this.) When this is accomplished, click OK and the Line file data will be converted to Polygon data and stored as a Polygon Shapefile in the folder indicated. This Shapefile can now be used in DriveTest for a Country boundary or Region boundary outline. See the DriveTest User Manual Appendix titled Third Party ESRI Map Data detailing the required format for Map Data used by DriveTest mapping software. 6
You can also read