gurucomkz / geopicker
Geolocation Picker field for SilverStripe
Installs: 29
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:silverstripe-vendormodule
Requires
- silverstripe/admin: ^1.7@dev
This package is auto-updated.
Last update: 2024-12-20 17:14:38 UTC
README
Provides a GeoLocation
(for coordinates) field editable with a map.
Uses Google Places API to display the map.
Enable Places API & Maps JavaScript API
Maps JavaScript API is used to display the map.
Places API is used to let you find things there by typing an address.
Check out the following links to get it working
- https://developers.google.com/maps/gmp-get-started#enable-api-sdk
- https://developers.google.com/maps/documentation/places/web-service/get-api-key
Then put the key into your .env file:
PLACES_API_KEY="the-key"
Usage
class Foo extends DataObject { private static $db = [ 'Location' => 'GeoLocation', ]; } # OR class Foo extends DataObject { private static $db = [ 'Location' => DBGeoLocation::class, ]; }
You can then refer to it as
$obj->Location->Latitude; $obj->Location->Longitude;