2017 © Pedro Peláez
 

silverstripe-module geolocation

GeoLocation FieldTypes - allow calculations on geolocations

image

andrelohmann-silverstripe/geolocation

GeoLocation FieldTypes - allow calculations on geolocations

  • Monday, February 29, 2016
  • by andrelohmann
  • Repository
  • 1 Watchers
  • 2 Stars
  • 616 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 2 Forks
  • 3 Open issues
  • 4 Versions
  • 1 % Grown

The README.md

silverstripe geolocation

Maintainers

  • Andre Lohmann (Nickname: andrelohmann)

Requirements

Silverstripe 3.3.x, (*1)

Introduction

GeoLocation FieldTypes - allow calculations on geolocations., (*2)

Installation

geolocation needs a UDF (mysql user defined function) to be created either create this function manually with the following SQL Statement (copy/paste to phpmyadmin), (*3)

DROP FUNCTION IF EXISTS geodistance;
delimiter //
CREATE FUNCTION geodistance (lat1 DOUBLE, lng1 DOUBLE, lat2 DOUBLE, lng2 DOUBLE) RETURNS DOUBLE NO SQL
BEGIN
DECLARE radius DOUBLE;
DECLARE distance DOUBLE;
DECLARE vara DOUBLE;
DECLARE varb DOUBLE;
DECLARE varc DOUBLE;
SET lat1 = RADIANS(lat1);
SET lng1 = RADIANS(lng1);
SET lat2 = RADIANS(lat2);
SET lng2 = RADIANS(lng2);
SET radius = 6371.0;
SET varb = SIN((lat2 - lat1) / 2.0);
SET varc = SIN((lng2 - lng1) / 2.0);
SET vara = SQRT((varb * varb) + (COS(lat1) * COS(lat2) * (varc * varc)));
SET distance = radius * (2.0 * ASIN(CASE WHEN 1.0 < vara THEN 1.0 ELSE vara END));
RETURN distance;
END;
//
delimiter ;

or on each /dev/build by adding the following line to your _ss_environment.php, (*4)

define('CREATE_GEODISTANCE_UDF', true);

Set the Google Api Key inside your _ss_environment.php if necessary, (*5)

define('GOOGLE_MAPS_API_KEY', '__YOUR_KEY__');

The Versions

29/02 2016

dev-develop

dev-develop

GeoLocation FieldTypes - allow calculations on geolocations

  Sources   Download

BSD-3-Clause

The Requires

 

framework silverstripe

29/02 2016

dev-master

9999999-dev

GeoLocation FieldTypes - allow calculations on geolocations

  Sources   Download

BSD-3-Clause

The Requires

 

framework silverstripe

29/02 2016

1.0.1

1.0.1.0

GeoLocation FieldTypes - allow calculations on geolocations

  Sources   Download

BSD-3-Clause

The Requires

 

framework silverstripe

04/12 2015

1.0.0

1.0.0.0

GeoLocation FieldTypes - allow calculations on geolocations

  Sources   Download

BSD-3-Clause

The Requires

 

framework silverstripe