Download the PHP package webnuvola/geo without Composer

On this page you can find all versions of the php package webnuvola/geo. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package geo

Brick\Geo

A collection of classes to work with GIS geometries.

Build Status Coverage Status Latest Stable Version Total Downloads License

Introduction

This library is a PHP implementation of the OpenGIS specification.

It is essentially a wrapper around a third-party GIS engine, to which it delegates most of the complexity of the geometry calculations. Several engines are supported, from native PHP extensions such as GEOS to GIS-compatible databases such as MySQL or PostgreSQL.

Requirements and installation

This library requires 7.1 or later. for PHP 5.6 and PHP 7.0 support, use version 0.1.

Install the library with Composer:

Then head on to the Configuration section to configure a GIS geometry engine.

Failure to configure a geometry engine would result in a GeometryEngineException being thrown when trying to use a method that requires one.

Project status & release process

This library is still under development.

The current releases are numbered 0.x.y. When a non-breaking change is introduced (adding new methods, optimizing existing code, etc.), y is incremented.

When a breaking change is introduced, a new 0.x version cycle is always started.

It is therefore safe to lock your project to a given release cycle, such as 0.2.*.

If you need to upgrade to a newer release cycle, check the release history for a list of changes introduced by each further 0.x.0 version.

Configuration

Configuring the library consists in choosing the most convenient GeometryEngine implementation for your installation. The following implementations are available:

Following is a step-by-step guide for all the possible configurations:

Using PDO and MySQL 5.6 or greater

Update the code with your own connection parameters, or use an existing PDO connection if you have one (recommended).

Using PDO and MariaDB 5.5 or greater

MariaDB is a fork of MySQL, so you can follow the same procedure as for MySQL. Just ensure that your MariaDB version is 5.5 or greater.

Using PDO and PostgreSQL with PostGIS

Update the code with your own connection parameters, or use an existing PDO connection if you have one (recommended).

Using PDO and SQLite with SpatiaLite

Due to limitations in the PDO_SQLITE driver, it is currently not possible to load the SpatiaLite extension with a SELECT LOAD_EXTENSION() query, hence you cannot use SpatiaLite with the PDO driver.

You need to use the SQLite3 driver instead. Note that you can keep using your existing PDO_SQLITE code, all you need to do is create an additional in-memory SQLite3 database just to power the geometry engine.

Using SQLite3 with SpatiaLite

In this example we have created an in-memory database for our GIS calculations, but you can also use an existing SQLite3 connection.

Using GEOS PHP bindings

Geometry hierarchy

All geometry objects reside in the Brick\Geo namespace, and extend a base Geometry class:

Geometry exceptions

All geometry exceptions reside in the Brick\Geo\Exception namespace, and extend a base GeometryException object.

Geometry exceptions are fine-grained: only subclasses of the base GeometryException class are thrown throughout the project. This leaves to the user the choice to catch only specific exceptions, or all geometry-related exceptions.

Here is a list of all exceptions:

Example

use Brick\Geo\Polygon;

$polygon = Polygon::fromText('POLYGON ((0 0, 0 3, 3 3, 0 0))');
echo $polygon->area(); // 4.5

$centroid = $polygon->centroid();
echo $centroid->asText(); // POINT (1 2)

Spatial Function Reference

This is a list of all functions which are currently implemented in the geo project. Some functions are only available if you use a specific geometry engine, sometimes with a minimum version. This table also shows which functions are part of the OpenGIS standard.

Function Name GEOS PostGIS MySQL MariaDB SpatiaLite OpenGIS standard
area
boundary
buffer
centroid
contains
convexHull 5.7.6
crosses
difference
disjoint
distance
envelope
equals
intersects
intersection
isSimple
isValid 5.7.6
length
locateAlong
locateBetween
maxDistance
overlaps
pointOnSurface
relate
simplify 5.7.6 4.1.0
snapToGrid
symDifference
touches
union
within

Importing and exporting geometries

This library supports importing from and exporting to the following formats:

WKT

Well-Known Text is the standard text format for geometries.

Every Geometry class provides a convenience method fromText(), that accepts a WKT string and an optional SRID, and returns a Geometry object:

Geometries can be converted to WKT using the convenience method asText():

You can alternatively use the WKTReader and WKTWriter classes directly; the latter allows you to pretty-print the output.

WKB

Well-Known Binary is the standard binary format for geometries.

Every Geometry class provides a convenience method fromBinary(), that accepts a WKB binary string and an optional SRID, and returns a Geometry object:

Geometries can be converted to WKB using the convenience method asBinary():

You can alternatively use the WKBReader and WKBWriter classes directly; the latter allows you to choose the endianness of the output (big endian or little endian).

EWKT

Extended WKT is a PostGIS-specific text format that includes the SRID of the geometry object, which is missing from the standard WKT format. You can import from and export to this format using the EWKTReader and EWKTWriter classes:

EWKB

Extended WKB is a PostGIS-specific binary format that includes the SRID of the geometry object, which is missing from the standard WKB format. You can import from and export to this format using the EWKBReader and EWKBWriter classes:

GeoJSON

GeoJSON is an open standard format designed for representing simple geographical features, based on JSON, and standardized in RFC 7946.

This library supports importing geometries from, and exporting them to GeoJSON documents using the GeoJSONReader and GeoJSONWriter classes:

Note that Features are imported as Geometry objects, and FeatureCollections are imported as GeometryCollection objects. Non-spatial attributes are ignored.

GeoJSON aims to support WGS84 only, and as such all Geometries are imported using SRID 4326.


All versions of geo with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package webnuvola/geo contains the following files

Loading the files please wait ....