1. Go to this page and download the library: Download monster3d/gis-calculator library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
monster3d / gis-calculator example snippets
// vendor/autoload.php";
// Use main facade
$gitCalculator = new \GisCalculator\GisCalculator();
// Use simple point builder
$pointA = \GisCalculator\GisCalculator::makePoint(56.836341, 60.621788);
$pointB = \GisCalculator\GisCalculator::makePoint(56.827314, 60.625178);
$distance = $gitCalculator->getDistance($pointA, $pointB);
//** $distance float 750.8 */
// Use main facade
$gitCalculator = new \GisCalculator\GisCalculator();
// Call target module by name
$distance = $gitCalculator->getModule('distance');
if (null !== $distance) {
//Get private setting manager
$setting = $distance->getSetting();
//Add setting key 'round' value 3
$setting->setValue(\GisCalculator\Core\SettingsKeys::ROUND, 3);
}
// Use main facade
$gitCalculator = new \GisCalculator\GisCalculator();
// Create center point
$center = \GisCalculator\GisCalculator::makePoint(56.830794, 60.636087);
// Create search point
$point = \GisCalculator\GisCalculator::makePoint(56.830160, 60.630271);
// Create need search radius = 10 km
$radius = \GisCalculator\GisCalculator::makeRadius(10, \GisCalculator\Core\Metric::KILOMETERS);
// Search point in radius
$search = $gitCalculator->gisWithPointInRadius($center, $point, $radius);
if ($search) {
print_r('Ok, point enters radius');
}
// Can aslo use collection
$center = \GisCalculator\GisCalculator::makePoint(56.830794, 60.636087);
$point1 = \GisCalculator\GisCalculator::makePoint(56.830160, 60.630271);
$point2 = \GisCalculator\GisCalculator::makePoint(56.826579, 60.637781);
$point3 = \GisCalculator\GisCalculator::makePoint(56.662034, 60.434503);
// Create collection
$pointCollection = new \GisCalculator\Element\CollectionPoints();
$pointCollection
->setPoint($point1)
->setPoint($point2)
->setPoint($point3);
// Radius can use any metrict km, cm and etc...
$radius = \GisCalculator\GisCalculator::makeRadius(10, \GisCalculator\Core\Metric::KILOMETERS);
$searchPoints = $gitCalculator->gisWithCollectionInRadius($center, $radius, $pointCollection);
foreach($searchPoints as $point) {
// Give all points that were found in radius
}
// Use main facade
$gitCalculator = new \GisCalculator\GisCalculator();
// Create point A as from
$pointA1 = \GisCalculator\GisCalculator::makePoint(56.830794, 60.636087);
// Create point A as to
$pointA2 = \GisCalculator\GisCalculator::makePoint(56.830794, 60.636087);
// Create point B as from
$pointB1 = \GisCalculator\GisCalculator::makePoint(56.830794, 60.636087);
// Create point B as to
$pointB2 = \GisCalculator\GisCalculator::makePoint(56.830794, 60.636087);
// Run main facade method
$intersect = $gisCalculator->findGisPointIntersection($pointA1, $pointA2, $pointB1, $pointB2);
if (null !== $intersect) {
// This point where there was an intersection or null
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.