Frequently Asked Question

How to reduce the weigth of the geojson mapline file
Dernière mise à jour il y a un an

Symptom

  • Reduce the weigth (size) of the geojson file used in the Mapline, Webmapline & Drillmap components

Environment

  • Windows Server / Linux
  • Need4Viz : all versions

Resolution

Each time you display a custom map in a Mapline, Webmapline & Drillmap components, the geojson file is dynamically loaded on your laptop (by the browser). If your custom geojson file is heavy (more than 2 or 3 Mo), this loading can affect the performances of the browser and reduce speed to load the report (Webi report or HTML export page).

To enhance the performance, you can generally reduce the weight of your custom map without affect the details of the rendered map.

To do that, you can use an online tool like Mapshaper (or an internal tool if you have it). Mapshaper is accessible here : https://mapshaper.org/

Load into this tool your initial geojson file. If the file is correctly formatted, your map will be displayed on the tool. In the following example, the file size is more than 30Mo with extremly detailed borders :

image

To reduce the size of the file and visualize the render, you can click on "Simplify" then "Apply"

image

Now you can adjust the level of borders details using the slider:

image

In our example, if we adjust the level of details to 5%, the render is still correct :

image

You can now export the simplified geojson file clicking on "Export" and selecting "GeoJSON" file format:

image

In our example, the new generated geojson file size is now about 1Mo (compared to the 30Mo initial size).

Additional feature in MapShaper

If the layer is set in WGS84 coordinates, you can display it on an OpenStreetMap background, clicking on the top right layers buttons :

image

Result:

image

Veuillez patienter!

S'il vous plaît patienter... il faudra une seconde !