Skip to content
This repository has been archived by the owner on Dec 17, 2019. It is now read-only.
/ GeoBundle Public archive

Simple Doctrine Extension for working with Geo Data

Notifications You must be signed in to change notification settings

digilist/GeoBundle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This bundle provides a simple integration for the MySQL POINT-Datatype and some distance calculations.

Please note: This bundle is at an early stage of development, use it at your own risk!

Installation

Please install this bundle via composer (via a custom repository) and add the following options into your config.yml:

doctrine:
	dbal:
        types:
            point: Digilist\GeoBundle\ORM\PointType
        mapping_types:
            point: point

    orm:
        dql:
            numeric_functions:
                DISTANCE: Digilist\GeoBundle\ORM\Distance

Usage

After installation, you can now use the new POINT Datatype within your entity definitions.

/**
 * @Column(type="point")
 */
private $coordinates;

Distance Calculation (you can use the DISTANCE function anywhere in the query builder or in your DQL function):

// Query Builder
$qb = $this->getEntityManager()->createQueryBuilder();
$qb->from('Company', 'c')
   ->where('DISTANCE(c.coordinates, :lat, :lng) < 20')
   ->setParameter('lat', $point->getLatitude())
   ->setParameter('lng', $point->getLongitude());

About

Simple Doctrine Extension for working with Geo Data

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages