Configuring Leaflet Maps

To enable leaflet maps in ResourceSpace 9.6 you will need to set the following configuration option:-

$leaflet_maps_enable=true;

Leaflet maps configuration options

The following options can be configured to add tile sources and customise how gelocation data is displayed.

$geo_leaflet_maps_sources

Set to false by default

If enabled this lets client use a number of map tile providers however most of these are subject to strict usage terms, so unless you are using ResourceSpace for personal use these should not be enabled

If this option is enabled please refer to /include/map_basemaps to see the additional available configuration options that can be used to enable/disable the specific map providers.

$map_usgstopo
$map_usgsimagery
$map_usgsimagerytopo
Enables USGS provided public tile servers. TRUE by default. This is a subset of the sources included by leaflet maps and these options are only used if $geo_leaflet_maps_sources = true
$geo_leaflet_sources An array of tile servers that you have access to. A single source with three variants is configured as below and any additional sources must follow the same syntactical structure. Refer to lib/leaflet_plugins/leaflet-providers-1.10.2/leaflet-providers.js to see how this has been translated here.
 $geo_leaflet_sources[] = array(
            "name"          => "The National Map",
            "code"          => "USGSTNM",
            "url"           => "https://basemap.nationalmap.gov/arcgis/rest/services/USGSTopo/MapServer/tile/{z}/{y}/{x}",
            "maxZoom"       => 8,
            "detectRetina"  => true,
            "attribution"   => "<a href=\"https://www.doi.gov\">U.S. Department of the Interior</a> | <a href=\"https://www.usgs.gov\">U.S. Geological Survey</a>",
            "default"       => true,
            "extension"     => "jpeg",
            "variants"      => array(
                "USTopo"        => array(
                    "name"          => "US Topographic",
                ),
                "USImagery"     => array(
                    "name"          => "US Imagery",
                    "url"           => 'https://basemap.nationalmap.gov/arcgis/rest/services/USGSImageryOnly/MapServer/tile/{z}/{y}/{x}',
                    ),
                "USImageryTopo" => array(
                    "name"          => "US Imagery & Topographic",
                    "url"           => 'https://basemap.nationalmap.gov/arcgis/rest/services/USGSImageryTopo/MapServer/tile/{z}/{y}/{x}',
                ),
                )
            );
            
$search_map_max_results Limit number of search results that can be displayed in map view. Set to 0 for no limit
$map_zoomslider Set to true by default. Use zoom slidebar instead of standard +/- buttons
$map_zoomnavbar Set to true by default. Show zoom history navigation bar?
$map_default_cache Set to true by default. Cache default basemap layer tiles in the browser (recommended to reduce tile server load)
$map_layer_cache Set to true by default. Cache all map layer tiles in the browser
$map_retina Set to false by default. Enable retina display tiles (four tiles of half size and a larger zoom level in place of one to utilize higher resolution)
$map_default Set to 'USGSTNM.USTopo' by default. Leaflet default basemap - use the name.variant format as per your configured $geo_leaflet_sources
$marker_resource_preview Set to true by default. Open resource when clicking on a search result marker, instead of a small resource tooltip
$marker_metadata_field Not set by default. Custom map marker coloring based on a selected numeric value metadata field, instead of coloring by resource type, enable by setting a metadata field ID and descriptive text value.
$marker_metadata_array Only used if $marker_metadata_field is set to a valid field. Custom map marker coloring based on a selected numeric value metadata field, instead of coloring by resource type. Enable by setting a metadata field ID and descriptive text value. Example below shows an array of minimum and maximum numeric values for the markers on the map, with up to eight marker pairs (min >=, max <=) when using custom marker coloring.
        $marker_metadata_array = [
            0 => ['min' => 1935, 'max' => 1939], # Blue marker
            1 => ['min' => 1940, 'max' => 1949], # Red marker
            2 => ['min' => 1950, 'max' => 1959], # Green marker
            3 => ['min' => 1960, 'max' => 1969], # Orange marker
            4 => ['min' => 1970, 'max' => 1979], # Yellow marker
            5 => ['min' => 1980, 'max' => 1989], # Black marker
            6 => ['min' => 1990, 'max' => 1999], # Grey marker
            7 => ['min' => 2000, 'max' => 2010]  # Violet marker
        ];
        
$map_kml Set to false by default. Show a KML overlay on the map?
$map_kml_file Used if $map_kml =true. Set to empty string ('') by default. # Place KML file in ../filestore/system/, example: overlay.kml

Standard map tile options

$geo_tile_caching Set to true by default. Cache map tiles on your ResourceSpace server?
$geo_tile_cache_directory Optional path to tile cache directory. Useful if you are running multiple ResourceSpace instances
$geo_tile_cache_lifetime* How long will tiles be cached on the local server? Set to one year by default
Unless absolutely necessary this should be a long period to avoid too many requests to the tile server
$geo_tile_cache_lifetime = 60*60*24*365;
$hide_geolocation_panel Set to true to hide the geolocation panel by default and replace with a link
$geo_locate_collection Set to true to add a collection action that will show all resource geolocation data on a map
$geolocation_default_bounds* Set the default center and zoom for the map view when searching or selecting a new location.
# For example, to specify the USA use:
$geolocation_default_bounds="-10494743.596017,4508852.6025659,4";

# For example, to specify Utah, use
$geolocation_default_bounds="-12328577.96607,4828961.5663655,6";
$view_mapheight Height of map in pixels on resource view page
$geo_search_restrict An array that specifies a list of upper/lower longitude/latitude bounds. These are areas that will be excluded from geographical search results.
Areas are defined using values in the following sequence:-

southwest lat, southwest long, northeast lat, northeast long

An example is as below
$geo_search_restrict=array
    (	
    array(50,-3,54,3,)      # Example omission zone
    array(-10,-20,-8,-18),  # Example omission zone 2
    array(1,1,2,2)          # Example omission zone 3
    );