Serving private assets
You can serve private assets, such as pictures and JSON files, to use in visualizations. You maintain the files on your system, which are copied automatically to optimize/active_assets/private_assets.
To serve your assets, do the following:
-
Create a folder on your system and move the assets to the folder.
-
In
investigate.yml
, set the following property to the relative or absolute path of the folder containing the assets:
investigate_core.private_assets_dir: "/path/to/asset_folder"
-
Retrieve the assets from
//host:port/ui/private_assets/<filename.ext>
.
Examples
Example A: You have a picture that you want to serve for use in a markdown visualization.
The file name is picture.jpg
and it is located in assets_folder
in your home directory. You update investigate.yml
as follows:
investigate_core.private_assets_dir: "/home/assets_folder"
You can now access the picture at //host:port/ui/private_assets/picture.jpg
.
Example B:
You have a GeoJSON file that you want to serve to configure the map visualization.
The file name is regional_map.geojson
and it is located in assets_folder
in your home directory. You update investigate.yml
as follows:
investigate_core.private_assets_dir: "/home/assets_folder"
regionmap:
layers:
- name: "Departments of France"
url: "ui/private_assets/regional_map.geojson"
attribution: "INRAP"
fields:
- name: "department"
description: "Full department name"
- name: "INSEE"
description: "INSEE numeric identifier"
You can now access the GeoJSON file at //host:port/ui/private_assets/regional_map.geojson
.
For more information about regional maps, see Configuring Siren Investigate.