Maps - Generation, configuration of own backgrounds

Introduction

The document describes the mechanism for generating, configuring and displaying custom backgrounds for maps. Generation and configuration of maps is performed in two stages.

  • First, on the basis of the provided data, backgrounds in the TMS tiles format are generated. This means that the source image is divided into a set of small "tiles" so that loading the selected map area in a given zoom is as effective as possible and to download only as much information as is necessary

  • the second step is to upload your set of tiles to the server, which will make it available to all AMAGE system applications, and to configure individual maps in the system.

Tile set generation

The first step is to generate a set of tiles. The data source is a high-resolution raster (png) image, but the primary source can be DWG or PDF files with a plan/map. Individual chapters describe the generation mechanism using different types of software

Generation of graphic files from DWG Draftsight files

DWG file (Draftsight):

  1. Open the DWG file in DraftSight

  2. Visually improve what you can. Change the visibility of the layers so that there is not too much noise on the set.

  3. Go to printing

  4. Select the PNG format and print in this format (see screenshots below).

    1. Define your own print size.

    2. Select the export area and mark the area of interest with the mouse.

  5. Run gdal2tiles.py with options: gdal2tiles.py -t "map title" -p raster -z 0-6 <filename.png> <identifier e.g. 0001>

  6. We have a ready output in TMS format in directory 0001

Graphical step overview

maps draftsight krok1
Figure 1. Opening the plan
maps draftsight krok2
Figure 2. Layer selection
maps draftsight krok3
Figure 3. Custom format printout
maps draftsight krok4
Figure 4. Custom format parameters
maps draftsight krok5
Figure 5. Final print window (specify for range, print in center of paper, custom paper size)

Generation of graphic files from PDF files

After generating a PDF from any CAD program or having such a file (high resolution), we convert it to a PNG file using the pdftoppm program

pdftoppm -r <DPI> <pdf_file> <png filename template name> -png

The default DPI is 150dpi. Depending on the quality, we choose values in the range of 150-600dpi.

Generation of graphic files from DWG files (Autocad):

  1. Open the DWG file in the Autocad browser

  2. Go to printing

  3. Select the PNG output format

  4. Save to PNG format

  5. Run gdal2tiles.py with options: gdal2tiles.py -t "map title" -p raster -z 0-7 --s_srs=xyz map.png <map_id>

  6. We have ready output in TMS format

Generation of graphic files from PDF files

  1. We use the imagemagick and gs packages

  2. We invoke the conversion by: convert -density <dpi> file.pdf file.png . We set the DPI to any value of 300-800

  3. Files in PNG format are generated for each page separately

  4. Run gdal2tiles.py with options: gdal2tiles.py -t "map title" -p raster -z 0-7 --s_srs=xyz map.png <map_id>

  5. We have ready output in TMS format

Generation of graphic files using VariCAD Viewer

  • We open the DWG/DXF file in the VariCAD Viewer application

  • We call the option File→`Print`→`Print to selected printer`

  • We call the option to print to PDF. We try to determine the highest possible resolution of the resulting file.

  • Then we proceed as in the case of printing from PDF files

VariCAD Viewer interface

amage maps 56b5d
Figure 6. print interface
amage maps b0afc
Figure 7. selection of print size and area
amage maps 1188b
Figure 8. changing the print format to the largest possible size
amage maps 9f9f3
Figure 9. printing and scaling

Generation Notes

Applications such as the DWG/DXF file viewer usually have limited capabilities, especially those related to printing layers and editing drawings (e.g. deleting elements on the map).
ATTENTION. If there is a problem in gdal2tiles after the export, e.g. the tiles are strange, i.e. only in the middle of a given tile there is a graphic, then the number of zoom levels should be increased (drawing too large)
The number of zoom levels depends on the file size and its content. For terrain maps zoom 0-7 is reasonable, for process maps (PID) zoom 0-5 is sufficient.

Configuration of maps in the AMAGE Web application

  • We open the configuration of dictionaries

  • We define new maps

  • We get the UUID of the new map

  • We save on the server in the directory defined in the configuration for maps (see AMAGE WEB Configuration documentation) in the subdirectory named above UUID

  • The system must be configured during deployment to work with an internal map server

Map configuration in the AMAGE Desktop application (legacy)

After uploading the background data to the server, the AMAGE Desktop, Web, Fx application must be properly configured. To do this, refer to the individual instructions. Below are the configurations for the Desktop application, which is the only one that has the ability to define new sleepers in the database.

The configuration is carried out in the main application settings. After enabling the settings, go to 'Maps' configuration.

maps config server map
Figure 10. Map server configuration

In this window we can:

  • define a default start position for map views. Unless otherwise specified, the map will be launched with the geographical center specified in the configuration.

  • Specify the type of map server. If we do not use the Sync server, the option is "Open Street Map". If you want to use the Sync server, select 'Custom map server'.

  • Store tiles locally - enabling this option will save all downloaded tiles to your local drive. This will speed up data loading, but may take up a lot of disk space. This cache can be cleared by selecting 'Clear Cache'

Even if you select 'Own Map Server' you have access to Open Street Map. The Sync server then acts as a proxy for the tiles served by OSM. This is the recommended configuration as the tiles are stored locally after the first download from the OSM servers.

If you choose your own map server and its correct configuration as above, you must additionally add all maps stored on the server to the list of maps. Selecting the 'Local maps' action, we go to the list of maps.

maps mapy list
Figure 11. Map list

In this window we can add new backgrounds. The app makes it easy to add a default OSM-based map. In the window for entering a new background, select the 'Create default' button. Then all parameters will be set correctly for OSM maps.

maps default maps
Figure 12. Default map layer

In any other case, you must manually add the map background along with all the details regarding the name and available zoom levels.

maps maps any
Figure 13. Any definable map layer

After you add maps and select your own map server, it is available to Desktop in the map viewer. After configuring other applications, they also receive additional functions related to new backgrounds for maps and plans. Have fun!

Server - installation of map layers

If we have a ready set of tiles, the next step is to upload it to the AMAGE Sync server, so that it can be served to all applications using its functions (AMAGE Desktop, Web, Fx, etc.). For this purpose, the generated tiles should be uploaded to the server to the directory <userdir>/maps/<map identifier>, where <userdir> is the configuration directory of the AMAGE Sync application and <map identifier> is the identifier that was generated when adding the map in the application.

Remember that the AMAGE Sync server should be running with the http server enabled and all applications should be properly configured to communicate with this server.