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):
-
Open the DWG file in DraftSight
-
Visually improve what you can. Change the visibility of the layers so that there is not too much noise on the set.
-
Go to printing
-
Select the PNG format and print in this format (see screenshots below).
-
Define your own print size.
-
Select the export area and mark the area of interest with the mouse.
-
-
Run gdal2tiles.py with options: gdal2tiles.py -t "map title" -p raster -z 0-6 <filename.png> <identifier e.g. 0001>
-
We have a ready output in TMS format in directory 0001
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):
-
Open the DWG file in the Autocad browser
-
Go to printing
-
Select the PNG output format
-
Save to PNG format
-
Run gdal2tiles.py with options: gdal2tiles.py -t "map title" -p raster -z 0-7 --s_srs=xyz map.png <map_id>
-
We have ready output in TMS format
Generation of graphic files from PDF files
-
We use the imagemagick and gs packages
-
We invoke the conversion by: convert -density <dpi> file.pdf file.png . We set the DPI to any value of 300-800
-
Files in PNG format are generated for each page separately
-
Run gdal2tiles.py with options: gdal2tiles.py -t "map title" -p raster -z 0-7 --s_srs=xyz map.png <map_id>
-
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
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.
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.
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.
In any other case, you must manually add the map background along with all the details regarding the name and available zoom levels.
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. |
App links
DWG Viewer: http://www.autodesk.com/products/dwg/viewers Draftsight: http://www.3ds.com/products-services/draftsight-cad-software/ GDAL: http://www.gdal. org/index.html GDAL Windows: https://sandbox.idre.ucla.edu/sandbox/tutorials/installing-gdal-for-windows