Collections functions
Encryption functions
General functions
Render functions
Theme permission functions
Video functions
Resource functions

leaflet_polygon_parsing()

Parameters

ColumnTypeDefaultDescription
$fields
$minmax true

Location

include/map_functions.php lines 460 to 489

Definition

 
function leaflet_polygon_parsing($fields$minmax true)
    {
    global 
$map_polygon_field;

    
// Search resource $fields array for the $map_polygon_field.
    
$key1 array_search($map_polygon_fieldarray_column($fields'ref'));

    if (
$minmax)
        {
        
// Strip coordinate pair parathenses from polygon array.
        
$values str_replace(')'''str_replace('('''explode(','$fields[$key1]['value'])));

        
// Determine minimum and maximum latitude values.
        
$lat_values = array($values[0], $values[2], $values[4], $values[6]);
        
$polygon['lat_min'] = min($lat_values);
        
$polygon['lat_max'] = max($lat_values);

        
// Determine minimum and maximum longitude values.
        
$long_values = array($values[1], $values[3], $values[5], $values[7]);
        
$polygon['long_min'] = min($long_values);
        
$polygon['long_max'] = max($long_values);
        }

    
// Format polygon string for Leaflet footprint display below.
    
$polygon1 str_replace('(''['$fields[$key1]['value']);
    
$polygon1 str_replace(')'']'$polygon1);
    
$polygon['values'] = '[' $polygon1 ']';

    return 
$polygon;
    }

This article was last updated 21st April 2021 19:05 Europe/London time based on the source file dated 29th March 2021 15:05 Europe/London time.