PHP Classes

File: aksara/Helpers/coordinate_helper.php

Recommend this page to a friend!
  Classes of Aby Dahana  >  Aksara  >  aksara/Helpers/coordinate_helper.php  >  Download  
File: aksara/Helpers/coordinate_helper.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: Aksara
A CodeIgniter based API and CRUD generator
Author: By
Last change: Initial commit for update 4.2.8

This commit focuses on functioning the market addons. Current progress was finished for:
1. Theme and module import;
2. Theme and module uninstall;
3. Theme preview (pre-install);
4. Theme changer;
5. Theme customizer;

Updating the theme and url helper that previously not working with imported theme and modules. Add the function to call the asset under theme and module. The route module (core) was added for getting the theme and module assets.

Changes on Assets controller to working with theme preview (related to base_url and asset_url configuration value).

Add the extension (intl) check (pre-install) and phpspreadsheet dependencies to scale up the app to produce the excel import and export.

Correct the installation migration that previously fail to execute (caused by invalid json format while insert the data on group privileges table "by typo"). Change the structure of app__users table and change the country field to country_id (also rewrite users and account module).

CORE
Adds the capability to using custom title and icon for each request method (create, read, update, delete etc.) that previously applied to set_desrcription() with array pair: [$method => $title] | [$method => $icon]. Correcting the missing variable called from CRUD search feature.

This commit already tested both MySQLi, PostgreSQL and SQLite3. You may help me to test to install it under SQL Server database to check if it's has no error.
Initial commit for update 4.2.8

Add the capability to install in SQLSRV, PostgreSQL and SQLite3 engine
Date: 10 hours ago
Size: 2,141 bytes
 

Contents

Class file image Download
<?php
/**
 * Coordinate Helper
 * Convert the map coordinate
 *
 * @author Aby Dahana
 * @profile abydahana.github.io
 * @website www.aksaracms.com
 * @since version 4.0.0
 * @copyright (c) 2021 - Aksara Laboratory
 */

function geojson2png($geojson = '[]', $stroke_color = '#ff0000', $fill_color = '#ff0000')
{
   
$geojson = json_decode($geojson);
   
$paths = '';
   
$markers = '';
   
    if(isset(
$geojson->features))
    {
        foreach(
$geojson->features as $key => $val)
        {
           
$properties = array();
           
            if(
in_array($val->geometry->type, array('LineString', 'MultiLineString')))
            {
               
$paths .= '&path=color:0x' . str_replace('#', null, $stroke_color) . '99|weight:1';

                foreach(
$val->geometry->coordinates as $_key => $_val)
                {
                    if(
is_array($_val))
                    {
                        foreach(
$_val as $__key => $__val)
                        {
                           
$paths .= '|' . $__val[1] . ',' . $__val[0];
                        }
                    }
                    else
                    {
                       
$paths .= '|' . $_val[1] . ',' . $_val[0];
                    }
                }
            }
            else if(
in_array($val->geometry->type, array('Polygon', 'MultiPolygon')))
            {
               
$paths .= '&path=color:0x' . str_replace('#', null, $stroke_color) . '|weight:1|fillcolor:0x' . str_replace('#', null, $fill_color);
               
                foreach(
$val->geometry->coordinates as $_key => $_val)
                {
                    foreach(
$_val as $__key => $__val)
                    {
                        if(
is_array($__val))
                        {
                           
$paths .= '|' . $__val[1] . ',' . $__val[0];
                        }
                    }
                }
            }
            else if(
in_array($val->geometry->type, array('Point', 'MultiPoint')))
            {
               
$markers .= '&markers=scale:1';
               
$markers .= '|' . $val->geometry->coordinates[1] . ',' . $val->geometry->coordinates[0];
            }
        }
    }
    else if(isset(
$geojson->lat) && isset($geojson->lng))
    {
       
$markers .= '&markers=scale:1';
       
$markers .= '|' . $geojson->lat . ',' . $geojson->lng;
    }
   
   
$params = array
    (
       
'key' => get_setting('openlayers_search_key'),
       
'zoom' => '',
       
'size' => '600x600'
   
);
   
    return
'http://maps.googleapis.com/maps/api/staticmap?' . http_build_query($params) . $markers . $paths;
}

For more information send a message to info at phpclasses dot org.