Download the PHP package vojtech-dobes/nette-forms-gpspicker without Composer
On this page you can find all versions of the php package vojtech-dobes/nette-forms-gpspicker. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download vojtech-dobes/nette-forms-gpspicker
More information about vojtech-dobes/nette-forms-gpspicker
Files in vojtech-dobes/nette-forms-gpspicker
Package nette-forms-gpspicker
Short Description Google Maps based picker of coordinates for Nette Framework.
License New BSD
Homepage http://github.com/vojtech-dobes/nette-forms-gpspicker
Informations about the package nette-forms-gpspicker
For Nette Framework
GPS coordinates picker. Try it now!
Drivers
- Google Maps API v3
- Mapy.cz API v4
- Nokia Maps API v2
- OpenStreetMap (using Google Maps API v3)
License
New BSD
Dependencies
Nette 2.0.0
Demo
http://vojtechdobes.com/gpspicker/
Installation
- Get the source code from Github or via Composer (
vojtech-dobes/nette-forms-gpspicker
). - Register
VojtechDobes\NetteForms\GpsPickerExtension
as extension. - Link appropriate maps API SDK and
client/nette.gpsPicker.js
inapp/templates/@layout.latte
.
In Nette 2.0, registration is done in
app/bootstrap.php
:
(for example when using Google Maps API v3)
Usage
You can add some options (every option has also some like setter thing):
If you prefer manual rendering, caption can be omitted:
Returned value is instance of GpsPoint
with lat
and lng
properties. It inherits from Nette\Object
.
You can set value (respectively default value) like this:
Validation
Now you can easily add various constraints on desired GPS:
First four rules will be also validated client-side.
Manual rendering
If the user doesn't support Javascript or gets offline, picker provides several inputs for setting coordinates manually. You can easily render them manually as well as whole complete element.
Search by address
Enabled by default, GpsPicker supports searching map by typing the address. Extra <input>
element will be prepended to map,
enhanced by Google Places Autocomplete service.
If you like to render it manually, use search
key:
You can disable/enable search feature with enableSearch
/disableSearch
pair of methods:
Or in constructor:
Providers
If you are afraid of exhausting API rate limit of Google Maps, you can use alternative provider as well. All you have to do is to link their appropriate API SDK and set the driver:
Available providers are:
Feature | Value |
---|---|
Usage | default (manually by calling ->setDriver(Gps::DRIVER_GOOGLE) ) |
Search by address | yes |
Supported types | Gps::TYPE_ROADMAP , Gps::TYPE_SATELLITE , Gps::TYPE_HYBRID , Gps::TYPE_TERRAIN |
Nokia
Feature | Value |
---|---|
Usage | ->setDriver(Gps::DRIVER_NOKIA) |
Search by address | no |
Supported types | Gps::TYPE_NORMAL , Gps::TYPE_SATELLITE , Gps::TYPE_TERRAIN |
OpenStreetMap
Feature | Value |
---|---|
Usage | ->setDriver(Gps::DRIVER_OPENSTREETMAP) |
Search by address | no |
Supported types | Gps::TYPE_ROADMAP , Gps::TYPE_SATELLITE , Gps::TYPE_HYBRID , Gps::TYPE_TERRAIN |
Seznam (Mapy.cz)
Feature | Value |
---|---|
Usage | ->setDriver(Gps::DRIVER_SEZNAM) |
Search by address | no |
Supported types | Gps::TYPE_BASE , Gps::TYPE_BIKE , Gps::TYPE_HISTORIC , Gps::TYPE_HYBRID ,Gps::TYPE_OPHOTO , Gps::TYPE_TRAIL , Gps::TYPE_TURIST |