2017 © Pedro Peláez
 

library proj4php

A PHP-Class for geographic coordinates transformation using proj4 definitions, thanks to a translation from Proj4JS

image

proj4php/proj4php

A PHP-Class for geographic coordinates transformation using proj4 definitions, thanks to a translation from Proj4JS

  • Wednesday, July 18, 2018
  • by judgej
  • Repository
  • 7 Watchers
  • 54 Stars
  • 60,418 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 29 Forks
  • 10 Open issues
  • 20 Versions
  • 12 % Grown

The README.md

Build Status Latest Stable Version Scrutinizer Code Quality, (*1)

proj4php

PHP-class for proj4 This is a PHP-Class for geographic coordinates transformation using proj4 definitions, thanks to a translation from Proj4JS., (*2)

Updated Requirements and Features

To keep up with the relentless pace of PHP versions and best practice, the following features are being implemented on this package:, (*3)

  • [x] Namespacing.
  • [ ] PHP5.4+ syntax (not aiming to be bleeding edge here, just yet)
  • [ ] PSR-2 styling
  • [x] PSR-4 autoloader
  • [x] semver release numbers to packagist.org
  • [x] Full compatibility with composer
  • [ ] Tests to come once the above is implemented.

Legacy branches proj4php5.2 and proj4php7.1 will be maintained for older applications that need it., (*4)

Installation

You can install the package via composer:, (*5)

composer require proj4php/proj4php

Using

// Use a PSR-4 autoloader for the `proj4php` root namespace.
include("vendor/autoload.php");

use proj4php\Proj4php;
use proj4php\Proj;
use proj4php\Point;

// Initialise Proj4
$proj4 = new Proj4php();

// Create two different projections.
$projL93    = new Proj('EPSG:2154', $proj4);
$projWGS84  = new Proj('EPSG:4326', $proj4);

// Create a point.
$pointSrc = new Point(652709.401, 6859290.946, $projL93);
echo "Source: " . $pointSrc->toShortString() . " in L93 <br>";

// Transform the point between datums.
$pointDest = $proj4->transform($projWGS84, $pointSrc);
echo "Conversion: " . $pointDest->toShortString() . " in WGS84<br><br>";

// Source: 652709.401 6859290.946 in L93
// Conversion: 2.3557811127971 48.831938054369 in WGS84

There are also ways to define inline projections. Check http://spatialreference.org/ref/epsg/ and seek for your projection and proj4 or OGC WKT definitions., (*6)

Add a new projection from proj4 definition with a name :, (*7)

// add it to proj4
$proj4->addDef("EPSG:27700",'+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +datum=OSGB36 +units=m +no_defs');

// then Create your projections
$projOSGB36 = new Proj('EPSG:27700',$proj4);

Or without a name :, (*8)

// Create your projection
$projOSGB36 = new Proj('+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +datum=OSGB36 +units=m +no_defs',$proj4);

You can also create your projection from OGC WKT definition :, (*9)

$projOSGB36 = new Proj('PROJCS["OSGB 1936 / British National Grid",GEOGCS["OSGB 1936",DATUM["OSGB_1936",SPHEROID["Airy 1830",6377563.396,299.3249646,AUTHORITY["EPSG","7001"]],AUTHORITY["EPSG","6277"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4277"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",49],PARAMETER["central_meridian",-2],PARAMETER["scale_factor",0.9996012717],PARAMETER["false_easting",400000],PARAMETER["false_northing",-100000],AUTHORITY["EPSG","27700"],AXIS["Easting",EAST],AXIS["Northing",NORTH]]',$proj4);

Developing - How to contribute

Feel free to fork us and submit your changes!, (*10)

OSGeo community project

ScreenShot, (*11)

Proj4php is also an OSGeo community project. See here for further details., (*12)

The Versions

18/07 2018

dev-master

9999999-dev https://github.com/proj4php/proj4php

A PHP-Class for geographic coordinates transformation using proj4 definitions, thanks to a translation from Proj4JS

  Sources   Download

LGPL-2.1

The Requires

  • php >=5.4.0

 

The Development Requires

coordinates proj4js geographic proj4

18/07 2018

dev-issue67

dev-issue67 https://github.com/proj4php/proj4php

A PHP-Class for geographic coordinates transformation using proj4 definitions, thanks to a translation from Proj4JS

  Sources   Download

LGPL-2.1

The Requires

  • php >=5.4.0

 

The Development Requires

coordinates proj4js geographic proj4

03/05 2017

2.0.9

2.0.9.0 https://github.com/proj4php/proj4php

A PHP-Class for geographic coordinates transformation using proj4 definitions, thanks to a translation from Proj4JS

  Sources   Download

LGPL-2.1

The Requires

  • php >=5.4.0

 

The Development Requires

coordinates proj4js geographic proj4

23/10 2016

dev-grid_support

dev-grid_support https://github.com/proj4php/proj4php

A PHP-Class for geographic coordinates transformation using proj4 definitions, thanks to a translation from Proj4JS

  Sources   Download

LGPL-2.1

The Requires

  • php >=5.4.0

 

The Development Requires

coordinates proj4js geographic proj4

13/09 2016

dev-fix-epsg28992

dev-fix-epsg28992 https://github.com/proj4php/proj4php

A PHP-Class for geographic coordinates transformation using proj4 definitions, thanks to a translation from Proj4JS

  Sources   Download

LGPL-2.1

The Requires

  • php >=5.4.0

 

The Development Requires

coordinates proj4js geographic proj4

01/07 2016

dev-sphere_property

dev-sphere_property https://github.com/proj4php/proj4php

A PHP-Class for geographic coordinates transformation using proj4 definitions, thanks to a translation from Proj4JS

  Sources   Download

LGPL-2.1

The Requires

  • php >=5.4.0

 

The Development Requires

coordinates proj4js geographic proj4

05/06 2016

2.0.8

2.0.8.0 https://github.com/proj4php/proj4php

A PHP-Class for geographic coordinates transformation using proj4 definitions, thanks to a translation from Proj4JS

  Sources   Download

LGPL-2.1

The Requires

  • php >=5.4.0

 

The Development Requires

coordinates proj4js geographic proj4

12/04 2016

2.0.7

2.0.7.0 https://github.com/proj4php/proj4php

A PHP-Class for geographic coordinates transformation using proj4 definitions, thanks to a translation from Proj4JS

  Sources   Download

LGPL-2.1

The Requires

  • php >=5.4.0

 

The Development Requires

coordinates proj4js geographic proj4

08/03 2016

dev-proj4php5.2

dev-proj4php5.2 https://github.com/proj4php/proj4php

A PHP-Class for geographic coordinates transformation using proj4 definitions, thanks to a translation from Proj4JS

  Sources   Download

LGPL-2.1

The Requires

  • php >=5.2.0

 

The Development Requires

coordinates proj4js geographic proj4

30/12 2015

2.0.6

2.0.6.0 https://github.com/proj4php/proj4php

A PHP-Class for geographic coordinates transformation using proj4 definitions, thanks to a translation from Proj4JS

  Sources   Download

LGPL-2.1

The Requires

  • php >=5.4.0

 

The Development Requires

coordinates proj4js geographic proj4

30/12 2015

dev-inline-projections

dev-inline-projections https://github.com/proj4php/proj4php

A PHP-Class for geographic coordinates transformation using proj4 definitions, thanks to a translation from Proj4JS

  Sources   Download

LGPL-2.1

The Requires

  • php >=5.4.0

 

The Development Requires

coordinates proj4js geographic proj4

07/12 2015

2.0.5

2.0.5.0 https://github.com/proj4php/proj4php

A PHP-Class for geographic coordinates transformation using proj4 definitions, thanks to a translation from Proj4JS

  Sources   Download

LGPL-2.1

The Requires

  • php >=5.4.0

 

The Development Requires

coordinates proj4js geographic proj4

24/11 2015

dev-adding-composer

dev-adding-composer https://github.com/proj4php/proj4php

A PHP-Class for geographic coordinates transformation using proj4 definitions, thanks to a translation from Proj4JS

  Sources   Download

LGPL-2.1

The Requires

  • php >=5.4.0

 

The Development Requires

coordinates proj4js geographic proj4

04/11 2015

2.0.4

2.0.4.0 https://github.com/proj4php/proj4php

A PHP-Class for geographic coordinates transformation using proj4 definitions, thanks to a translation from Proj4JS

  Sources   Download

LGPL-2.1

The Requires

  • php >=5.4.0

 

The Development Requires

coordinates proj4js geographic proj4

29/10 2015

2.0.3

2.0.3.0 https://github.com/proj4php/proj4php

A PHP-Class for geographic coordinates transformation using proj4 definitions, thanks to a translation from Proj4JS

  Sources   Download

LGPL-2.1

The Requires

  • php >=5.4.0

 

The Development Requires

coordinates proj4js geographic proj4

12/10 2015

dev-standardise-conversions

dev-standardise-conversions https://github.com/proj4php/proj4php

A PHP-Class for geographic coordinates transformation using proj4 definitions, thanks to a translation from Proj4JS

  Sources   Download

LGPL-2.1

The Requires

  • php >=5.4.0

 

The Development Requires

coordinates proj4js geographic proj4

11/10 2015

2.0.2

2.0.2.0 https://github.com/proj4php/proj4php

A PHP-Class for geographic coordinates transformation using proj4 definitions, thanks to a translation from Proj4JS

  Sources   Download

LGPL-2.1

The Requires

  • php >=5.4.0

 

The Development Requires

coordinates proj4js geographic proj4

03/10 2015

2.0.1

2.0.1.0 https://github.com/proj4php/proj4php

A PHP-Class for geographic coordinates transformation using proj4 definitions, thanks to a translation from Proj4JS

  Sources   Download

LGPL-2.1

The Requires

  • php >=5.4.0

 

The Development Requires

coordinates proj4js geographic proj4

26/09 2015

2.0.0

2.0.0.0 https://github.com/proj4php/proj4php

A PHP-Class for geographic coordinates transformation using proj4 definitions, thanks to a translation from Proj4JS

  Sources   Download

LGPL-2.1

The Requires

  • php >=5.4.0

 

The Development Requires

coordinates proj4js geographic proj4

22/09 2015

1.0.0

1.0.0.0 https://github.com/proj4php/proj4php

A PHP-Class for geographic coordinates transformation using proj4 definitions, thanks to a translation from Proj4JS

  Sources   Download

LGPL-2.1

The Requires

  • php >=5.2.0

 

The Development Requires

coordinates proj4js geographic proj4