Amap to GeoJson

Overview

This Python-based converter allows you to convert any AnyMap 4.x, 5.x and 6.x amap map source files to AnyMap 7.x GeoJSON based JavaScript, pure GeoJSON and SHP format.

You might have obtained .amap files from the set of maps AnyChart provided with old versions or created yourself with AnyChart SHP to AMAP Converter.

AnyChart 7.x maps collection can be found in AnyChart CDN Maps Collection.

Converter generates AnyMap 7.x GeoJSON based JavaScript (.js), pure GeoJSON (.json) and SHP (.shp, .shx and .dbf) formats in the specified output folder.

After you converted .amap file you can use .js or .json files directly in the new HTML5 AnyMap or tune .json or .shp files further as described in AnyMap Custom GeoJSON Maps Tutorial.

Installation

Windows

First of all, you need to download the converter from the github page of AMAP to JSON converter.

As far as this is a Python-based converter, you need to install Python version 2.7.x which can be obtained from the official Python download page.

Note: it is strongly recommended to add python.exe to Path during the installation:

Reboot your system to finish Python installation.

After you've installed Python on your PC you need to install all requirements for the converter. Run Command Prompt and switch to converter's folder:

  cd PATH\TO\THE\FOLDER

Here is a sample of switching to another folder in Command Prompt:

Then launch the process of installing requirements, run the following command:

  pip install -r requirements

After all the requirements are installed you will see the message as the screenshot below shows:

Unix

The process of installing converter in operation systems of the Unix family works almost in the same as for Windows. You need to download and install Python version 2.7.x from official Python web site and the converter itself from the AMAP to JSON Converter github page.

Then you install requirements. You need to launch the terminal and switch to the converter's directory:

  cd PATH\TO\THE\CONVERTER

Run the following command to launch installation of requirements:

  pip install -r requirements

Now we can proceed to converting AMAP files to JSON format.

Converting

Single File

Conversion of .amap files works the same in all the systems: you need to switch to the converter's folder and run the following command:

  python converter.py PATH\TO\YOUR\MAP\sample.amap OUTPUT_PATH\FILE_NAME

Here is a screenshot of a converted .amap file:

Multiple Files

There is a special script to convert files in batch. There are two different scripts for batch conversion: windows_convert-batch.bat - for Windows system and convert-batch - for Unix-like systems.

The way of converting multiple files in both systems is pretty much the same: launch the script in termnial and provide it with a path to a folder with .amap files and a path for the converted files.


Unix systems

  ./convert-batch src-folder output-folder

Converting a folder with amap files in UNIX:

If the source folder for the conversion is:

The output folder will contain several folders with files like these:

Windows

  windows_convert-batch.bat src-folder out-folder

The result folder in Windows may look like this:

You are looking at an outdated v7 version of this document. Switch to the v8 version to see the up to date information.