Web Map Tile Services Tiny Tile Server Bachelor Thesis
Total Page:16
File Type:pdf, Size:1020Kb
Web Map Tile Services Tiny Tile Server Bachelor Thesis Department of Computer Science University of Applied Science Rapperswil Spring Term 2013 Author: Carmen Campos Bordons Advisor: Prof. Stefan Keller, HSR Project Partner: Klokan Technologies, Baar External Co-Examiner: Claude Eisenhut, Burgdorf Internal Co-Examiner: Prof. Dr. Andreas Rinkel, HSR Abstract Tiny Tile Server is a Python server that permits the user to display local MBTiles maps on the internet. It extracts the data from the SQLite database where the map information is stored in tables containing all the tiles, UTFGrid and metadata. The tiles are the map images, smaller than the screen for better performance. The UTFGrid is some extra information related with points in the map that appears in an infobox when the user interact with these points. The metadata is the information about the map: name, description, bounds, legend, center, minzoom, maxzoom. Tiny Tile Server shows the tiles composing the map on a website and the UTFGrid data on top of the tiles. It can also be used to show the getCapabilities information from Web Map Tile Service in XML format extracted by the metadata table. Tiny Tile Server supports two protocols to access the tiles: direct access with XYZ tile request to tiles in a directory or to MBTiles database; or Web Map Tile Service from a MBTiles database. The server is a part in a website whose purpose is to show how it works and provide templates for the user who wants to employ it, so he will not need to have programming knowledge in order to use Tiny Tile Server, just to follow a simple installation tutorial. To display the map, the user can choose between two different kind of templates: using OpenLayers or Leaflet, which are libraries specialized in creating maps. Because the user will need to have a map in a MBTiles database, tutorials about how to create a map there are also provided. Website: http://152.96.56.43/ Repository: https://github.com/carmencampos/WMTS 2 of 105 Management summary Introduction This project has been performed with the main objective of displaying local maps in MBTiles format on the internet. That is the purpose of Tiny Tile Server. But also a website has been developed with templates showing examples that the final user will only need to adapt to display his maps. There are also tutorials about how to create your own map. There are already similar projects related with serving tiles stored in a MBTiles file. What makes Tiny Tile Server different is that it is also focused on users who do not need to have programming skills, which is why it is simpler and easier to use. Tiny Tile Server could also be used by developers to add new functionalities on it. Results Tiny Tile Server extracts the data from the SQLite database where the map information is stored in tables containing all the tiles, UTFGrid and metadata. 3 of 105 Then it shows the tiles composing the map on a website and the UTFGrid data on top of the tiles. It can also be used to show the getCapabilities information from Web Map Tile Service in XML format extracted by the metadata table. Tiny Tile Server supports two protocols to access the tiles: direct access with XYZ tile request to tiles in a directory or to MBTiles database; or Web Map Tile Service from a MBTiles database. Technologies The frontend is programmed using HTML5, CSS3 and JavaScript. There are also used two libraries specialized in creating maps: Leaflet and OpenLayers. These libraries permits us to display our thematic map on the internet on top of a base layer with topographic information, 4 of 105 for that purpose is used OpenStreetMap. They also permit to add some functionalities in our map, like zoom, scale, legend. The backend is written in Python and using Bottle as only external dependency. Bottle is necessary to handle requests/responses to the server, to get and to operate with the variables and to simplify routing. Outlook The website can be used for any kind of user who wants to display its thematic maps on the internet. The workspace is easy to reproduce and do not need any external reference apart from installing Python. With the templates, which are well documented, the user only need to change the part of the code to reference its maps. There are also some tutorials to create a map in MBTiles format, in case the user needs it. Tiny Tile Server can be installed in a different scope instead of a Python website. Using Tiny Tile Server in a different scope that the website could be difficult for a normal user with no programming knowledge. This is completely possible, but it is more focused for web developers who prefer to integrate this server in another application or use a different web framework instead of Bottle. Website: http://152.96.56.43/ Repository: https://github.com/carmencampos/WMTS 5 of 105 Index Abstract ......................................................................................................................................... 2 Management summary................................................................................................................. 3 Index.............................................................................................................................................. 6 Definition of the project................................................................................................................ 9 Licensing agreement ................................................................................................................... 11 Author declaration (Eigenständigkeitserklärung) ....................................................................... 12 Technical report .......................................................................................................................... 13 1. Introduction ........................................................................................................................ 14 1.2. Presentation of the problem............................................................................................ 14 1.3. Goals................................................................................................................................. 14 1.4. Conditions, environment, definitions and delimitations ................................................. 15 1.5. Construction work............................................................................................................ 16 2. Initial situation .................................................................................................................... 17 2.1. Existing approaches.......................................................................................................... 17 2.2. Brief description and characterization............................................................................. 17 Wax to add functionalities to our map ............................................................................... 17 Tileserver to serve MBTiles on a website............................................................................ 18 Leaflet.utfgrid: a new kind of layer in Leaflet ..................................................................... 18 TileStache ............................................................................................................................ 19 TileCloud.............................................................................................................................. 19 Importing and exporting MBTiles using MBUtil.................................................................. 19 Create a mbtiles database of a GeoTIFF using raster2mb .................................................. 19 Create tiles of a GeoTIFF map using gdal2tiles ................................................................... 19 Create tiles of a GeoTIFF map using MapTiler .................................................................... 22 Landez operates and creates MBTiles files ......................................................................... 24 Python-mbtiles helps you working with MBTiles databases............................................... 24 MapProxy ............................................................................................................................ 24 MapCache............................................................................................................................ 32 2.3. Further development ....................................................................................................... 35 3. Review................................................................................................................................. 37 3.1. Criteria.............................................................................................................................. 37 3.2. Conclusions ...................................................................................................................... 37 4. Implementation plan........................................................................................................... 39 6 of 105 4.1. Rough outline of my own solution concept ..................................................................... 39 4.2. Restrictions to consider.................................................................................................... 40 5. Results, evaluation and outlook.......................................................................................... 41 5.1. Achievement of objectives..............................................................................................