Collections functions
General functions
Node functions
Render functions
Theme permission functions
User functions
Resource functions

leaflet_polygon_parsing()

Parameters

ColumnTypeDefaultDescription
$fields
$minmax true

Location

include/map_functions.php lines 448 to 477

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 23rd April 2024 16:35 Europe/London time based on the source file dated 9th April 2024 11:40 Europe/London time.