1651292040
PHPGeo - A Simple Geo Library for PHP
phpgeo provides abstractions to geographical coordinates (including support for different ellipsoids) and allows you to calculate geographical distances between coordinates with high precision.
Minimum required PHP version is 7.3. phpgeo fully supports PHP 8.
The 3.x releases require PHP >= 7.2 but don't get feature updates any longer. Bugfixes will be backported.
The 2.x releases require PHP >= 7.0 but don't get feature updates any longer. Bugfixes won't be backported.
The 1.x release line has support for PHP >= 5.4. Bugfixes won't be backported.
The documentation is available at https://phpgeo.marcusjaschen.de/
API documentation is available as well: https://phpgeo.marcusjaschen.de/api/
Using Composer, just add it to your composer.json
by running:
composer require mjaschen/phpgeo
Update the version constraint in the project's composer.json
and run composer update
or require the new version by running:
composer require mjaschen/phpgeo:^4.0
Starting with version 2.0.0 phpgeo is licensed under the MIT license. Older versions were GPL-licensed.
Info: Please visit the documentation site for complete and up-to-date documentation with many examples!
phpgeo provides the following features (follow the links for examples):
18° 54′ 41″ -155° 40′ 42″
)This list is incomplete, please visit the documentation site for the full monty of documentation and examples!
Use the calculator object directly:
<?php
use Location\Coordinate;
use Location\Distance\Vincenty;
$coordinate1 = new Coordinate(19.820664, -155.468066); // Mauna Kea Summit
$coordinate2 = new Coordinate(20.709722, -156.253333); // Haleakala Summit
$calculator = new Vincenty();
echo $calculator->getDistance($coordinate1, $coordinate2); // returns 128130.850 (meters; ≈128 kilometers)
or call the getDistance()
method of a Coordinate object by injecting a calculator object:
<?php
use Location\Coordinate;
use Location\Distance\Vincenty;
$coordinate1 = new Coordinate(19.820664, -155.468066); // Mauna Kea Summit
$coordinate2 = new Coordinate(20.709722, -156.253333); // Haleakala Summit
echo $coordinate1->getDistance($coordinate2, new Vincenty()); // returns 128130.850 (meters; ≈128 kilometers)
Polylines can be simplified to save storage space or bandwidth. Simplification is done with the Ramer–Douglas–Peucker algorithm (AKA Douglas-Peucker algorithm).
<?php
use Location\Coordinate;
use Location\Polyline;
use Location\Distance\Vincenty;
$polyline = new Polyline();
$polyline->addPoint(new Coordinate(10.0, 10.0));
$polyline->addPoint(new Coordinate(20.0, 20.0));
$polyline->addPoint(new Coordinate(30.0, 10.0));
$processor = new Simplify($polyline);
// remove all points which perpendicular distance is less
// than 1500 km from the surrounding points.
$simplified = $processor->simplify(1500000);
// simplified is the polyline without the second point (which
// perpendicular distance is ~1046 km and therefore below
// the simplification threshold)
phpgeo has a polygon implementation which can be used to determinate if a point is contained in it or not. A polygon consists of at least three points. Points are instances of the Coordinate
class.
Warning: The calculation gives wrong results if the polygons has points on both sides of the 180/-180 degrees meridian.
<?php
use Location\Coordinate;
use Location\Polygon;
$geofence = new Polygon();
$geofence->addPoint(new Coordinate(-12.085870,-77.016261));
$geofence->addPoint(new Coordinate(-12.086373,-77.033813));
$geofence->addPoint(new Coordinate(-12.102823,-77.030938));
$geofence->addPoint(new Coordinate(-12.098669,-77.006476));
$outsidePoint = new Coordinate(-12.075452, -76.985079);
$insidePoint = new Coordinate(-12.092542, -77.021540);
var_dump($geofence->contains($outsidePoint)); // returns bool(false) the point is outside the polygon
var_dump($geofence->contains($insidePoint)); // returns bool(true) the point is inside the polygon
You can format a coordinate in different styles.
<?php
use Location\Coordinate;
use Location\Formatter\Coordinate\DecimalDegrees;
$coordinate = new Coordinate(19.820664, -155.468066); // Mauna Kea Summit
echo $coordinate->format(new DecimalDegrees());
<?php
use Location\Coordinate;
use Location\Formatter\Coordinate\DMS;
$coordinate = new Coordinate(18.911306, -155.678268); // South Point, HI, USA
$formatter = new DMS();
echo $coordinate->format($formatter); // 18° 54′ 41″ -155° 40′ 42″
$formatter->setSeparator(", ")
->useCardinalLetters(true)
->setUnits(DMS::UNITS_ASCII);
echo $coordinate->format($formatter); // 18° 54' 41" N, 155° 40' 42" W
<?php
use Location\Coordinate;
use Location\Formatter\Coordinate\GeoJSON;
$coordinate = new Coordinate(18.911306, -155.678268); // South Point, HI, USA
echo $coordinate->format(new GeoJSON()); // { "type" : "point" , "coordinates" : [ -155.678268, 18.911306 ] }
Before submitting a pull request, please be sure to run all checks and tests and ensure everything is green.
composer ci:lint
composer ci:psalm
composer ci:tests
To run all checks and tests at once, just use composer ci
.
Of course, it's possible to use the test runners directly, e.g. for PHPUnit:
./vendor/bin/phpunit
Psalm:
./vendor/bin/psalm
@clemdesign created a TypeScript port of phpgeo.
Author: mjaschen
Source Code: https://github.com/mjaschen/phpgeo
License: MIT License
1597820991
Looking to develop a PHP based website from scratch or revamp your existing website?
HourlyDeveloper.io has always been an industry leader for companies and business owners looking to hire PHP web developer. By choosing to Hire PHP Developer from our company, you can always expect the best results. Our PHP services and solutions are always flexible which means that no matter the nature of your project, you can always count on us for getting the best PHP expertise.
Consult with our experts: https://bit.ly/3aEGxPy
#hire php developer #php developer #php development company #php development services #php development #php
1651292040
PHPGeo - A Simple Geo Library for PHP
phpgeo provides abstractions to geographical coordinates (including support for different ellipsoids) and allows you to calculate geographical distances between coordinates with high precision.
Minimum required PHP version is 7.3. phpgeo fully supports PHP 8.
The 3.x releases require PHP >= 7.2 but don't get feature updates any longer. Bugfixes will be backported.
The 2.x releases require PHP >= 7.0 but don't get feature updates any longer. Bugfixes won't be backported.
The 1.x release line has support for PHP >= 5.4. Bugfixes won't be backported.
The documentation is available at https://phpgeo.marcusjaschen.de/
API documentation is available as well: https://phpgeo.marcusjaschen.de/api/
Using Composer, just add it to your composer.json
by running:
composer require mjaschen/phpgeo
Update the version constraint in the project's composer.json
and run composer update
or require the new version by running:
composer require mjaschen/phpgeo:^4.0
Starting with version 2.0.0 phpgeo is licensed under the MIT license. Older versions were GPL-licensed.
Info: Please visit the documentation site for complete and up-to-date documentation with many examples!
phpgeo provides the following features (follow the links for examples):
18° 54′ 41″ -155° 40′ 42″
)This list is incomplete, please visit the documentation site for the full monty of documentation and examples!
Use the calculator object directly:
<?php
use Location\Coordinate;
use Location\Distance\Vincenty;
$coordinate1 = new Coordinate(19.820664, -155.468066); // Mauna Kea Summit
$coordinate2 = new Coordinate(20.709722, -156.253333); // Haleakala Summit
$calculator = new Vincenty();
echo $calculator->getDistance($coordinate1, $coordinate2); // returns 128130.850 (meters; ≈128 kilometers)
or call the getDistance()
method of a Coordinate object by injecting a calculator object:
<?php
use Location\Coordinate;
use Location\Distance\Vincenty;
$coordinate1 = new Coordinate(19.820664, -155.468066); // Mauna Kea Summit
$coordinate2 = new Coordinate(20.709722, -156.253333); // Haleakala Summit
echo $coordinate1->getDistance($coordinate2, new Vincenty()); // returns 128130.850 (meters; ≈128 kilometers)
Polylines can be simplified to save storage space or bandwidth. Simplification is done with the Ramer–Douglas–Peucker algorithm (AKA Douglas-Peucker algorithm).
<?php
use Location\Coordinate;
use Location\Polyline;
use Location\Distance\Vincenty;
$polyline = new Polyline();
$polyline->addPoint(new Coordinate(10.0, 10.0));
$polyline->addPoint(new Coordinate(20.0, 20.0));
$polyline->addPoint(new Coordinate(30.0, 10.0));
$processor = new Simplify($polyline);
// remove all points which perpendicular distance is less
// than 1500 km from the surrounding points.
$simplified = $processor->simplify(1500000);
// simplified is the polyline without the second point (which
// perpendicular distance is ~1046 km and therefore below
// the simplification threshold)
phpgeo has a polygon implementation which can be used to determinate if a point is contained in it or not. A polygon consists of at least three points. Points are instances of the Coordinate
class.
Warning: The calculation gives wrong results if the polygons has points on both sides of the 180/-180 degrees meridian.
<?php
use Location\Coordinate;
use Location\Polygon;
$geofence = new Polygon();
$geofence->addPoint(new Coordinate(-12.085870,-77.016261));
$geofence->addPoint(new Coordinate(-12.086373,-77.033813));
$geofence->addPoint(new Coordinate(-12.102823,-77.030938));
$geofence->addPoint(new Coordinate(-12.098669,-77.006476));
$outsidePoint = new Coordinate(-12.075452, -76.985079);
$insidePoint = new Coordinate(-12.092542, -77.021540);
var_dump($geofence->contains($outsidePoint)); // returns bool(false) the point is outside the polygon
var_dump($geofence->contains($insidePoint)); // returns bool(true) the point is inside the polygon
You can format a coordinate in different styles.
<?php
use Location\Coordinate;
use Location\Formatter\Coordinate\DecimalDegrees;
$coordinate = new Coordinate(19.820664, -155.468066); // Mauna Kea Summit
echo $coordinate->format(new DecimalDegrees());
<?php
use Location\Coordinate;
use Location\Formatter\Coordinate\DMS;
$coordinate = new Coordinate(18.911306, -155.678268); // South Point, HI, USA
$formatter = new DMS();
echo $coordinate->format($formatter); // 18° 54′ 41″ -155° 40′ 42″
$formatter->setSeparator(", ")
->useCardinalLetters(true)
->setUnits(DMS::UNITS_ASCII);
echo $coordinate->format($formatter); // 18° 54' 41" N, 155° 40' 42" W
<?php
use Location\Coordinate;
use Location\Formatter\Coordinate\GeoJSON;
$coordinate = new Coordinate(18.911306, -155.678268); // South Point, HI, USA
echo $coordinate->format(new GeoJSON()); // { "type" : "point" , "coordinates" : [ -155.678268, 18.911306 ] }
Before submitting a pull request, please be sure to run all checks and tests and ensure everything is green.
composer ci:lint
composer ci:psalm
composer ci:tests
To run all checks and tests at once, just use composer ci
.
Of course, it's possible to use the test runners directly, e.g. for PHPUnit:
./vendor/bin/phpunit
Psalm:
./vendor/bin/psalm
@clemdesign created a TypeScript port of phpgeo.
Author: mjaschen
Source Code: https://github.com/mjaschen/phpgeo
License: MIT License
1617276472
A framework that can drastically cut down the requirement to write original code to develop the web apps as per your requirement is PHP Framework. PHP frameworks offer code libraries for commonly used functions to reduce the development time.
Want to use PHP Web Frameworks for your web applications?
WebClues Infotech offers a service to hire dedicated PHP developers for all of the below-mentioned frameworks
Not sure which framework to use for your PHP web application?
Schedule Interview with PHP Developer https://bit.ly/3dsTWf0
Email: sales@webcluesinfotech.com
#hire php developer #hire php web developers #hire php developer in 2021 #hire php developers & dedicated php programmers #hire php developers india #hire and outsource freelance php developers
1620885491
Hire top dedicated Mirosoft power BI consultants from ValueCoders who aim at leveraging their potential to address organizational challenges for large-scale data storage and seamless processing.
We have a team of dedicated power BI consultants who help start-ups, SMEs, and enterprises to analyse business data and get useful insights.
What are you waiting for? Contact us now!
No Freelancers, 100% Own Staff
Experienced Consultants
Continuous Monitoring
Lean Processes, Agile Mindset
Non-Disclosure Agreement
Up To 2X Less Time
##power bi service #power bi consultant #power bi consultants #power bi consulting #power bi developer #power bi development
1619670565
Hire our expert Power BI consultants to make the most out of your business data. Our power bi developers have deep knowledge in Microsoft Power BI data modeling, structuring, and analysis. 16+ Yrs exp | 2500+ Clients| 450+ Team
Visit Website - https://www.valuecoders.com/hire-developers/hire-power-bi-developer-consultants
#power bi service #power bi consultant #power bi consultants #power bi consulting #power bi developer #power bi consulting services