PHPackages                             vojtys/nette-forms-gpspicker - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. vojtys/nette-forms-gpspicker

ActiveLibrary

vojtys/nette-forms-gpspicker
============================

Google Maps based picker of coordinates for Nette Framework.

1.5.1(2y ago)01.2k1BSD-3-ClausePHPPHP &gt;=7.1

Since Aug 26Pushed 2y ago1 watchersCompare

[ Source](https://github.com/vojtys/nette-forms-gpspicker)[ Packagist](https://packagist.org/packages/vojtys/nette-forms-gpspicker)[ Docs](http://github.com/vojtech-dobes/nette-forms-gpspicker)[ RSS](/packages/vojtys-nette-forms-gpspicker/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (2)DependenciesVersions (21)Used By (0)

For Nette Framework
-------------------

[](#for-nette-framework)

GPS coordinates picker. [Try it now!](http://vojtechdobes.com/gpspicker/)

##### Drivers

[](#drivers)

- Google Maps API v3
- Mapy.cz API v4
- Nokia Maps API v2
- OpenStreetMap (using Google Maps API v3)

##### License

[](#license)

New BSD

##### Dependencies

[](#dependencies)

Nette 2.0.0

##### Demo

[](#demo)

Installation
------------

[](#installation)

1. Get the source code from Github or via Composer (`vojtech-dobes/nette-forms-gpspicker`).
2. Register `VojtechDobes\NetteForms\GpsPickerExtension` as extension.
3. Link appropriate maps API SDK and `client/nette.gpsPicker.js` in `app/templates/@layout.latte`.

```
extensions:
	gpspicker: VojtechDobes\NetteForms\GpsPickerExtension
```

> In Nette 2.0, registration is done in `app/bootstrap.php`:

```
$configurator->onCompile[] = function ($configurator, $compiler) {
	$compiler->addExtension('gpspicker', new VojtechDobes\NetteForms\GpsPickerExtension);
};
```

```

```

*(for example when using Google Maps API v3)*

Usage
-----

[](#usage)

```
$form->addGpsPicker('coords', 'Coordinates:');
```

You can add some options (every option has also some like setter thing):

```
$form->addGpsPicker('coords', 'Coordinates:', array(
	'type' => VojtechDobes\NetteForms\GpsPicker::TYPE_SATELLITE,
	'zoom' => 1, // something like whole planet I guess
	'size' => array(
		'x' => 411,
		'y' => 376,
	),
));
```

If you prefer manual rendering, caption can be omitted:

```
$form->addGpsPicker('coords', array(
	'type' => ...
	...
));
```

Returned value is instance of `GpsPoint` with `lat` and `lng` properties. It inherits from `Nette\Object`.

```
$lat = $form->values->coords->lat;
$lng = $form->values->coords->lng;
```

You can set value (respectively default value) like this:

```
$form['coords']->setDefaultValue(array(
	'lat' => 50.103245,
	'lng' => 14.474691,
));
```

### Validation

[](#validation)

```
use VojtechDobes\NetteForms\GpsPicker as Gps;
```

Now you can easily add various constraints on desired GPS:

```
$form->addGpsPicker('coords')
	->addRule(Gps::MIN_LAT, 'Minimal latitude must be %f.', 20)
	->addRule(Gps::MIN_LNG, 'Minimal longitude must be %f.', 40)
	->addRule(Gps::MAX_LAT, 'Maximum latitude must be %f.', 20)
	->addRule(Gps::MAX_LNG, 'Maximum longitude must be %f.', 40)
	->addRule(Gps::MIN_DISTANCE_FROM, 'Minimal distance from Prague must be %d m.', array(15000, array(
		'lat' => 50.083,
		'lng' => 14.423,
	)));
	->addRule(Gps::MAX_DISTANCE_FROM, 'Maximum distance from Prague must be %d m.', array(100000, array(
		'lat' => 50.083,
		'lng' => 14.423,
	)));
```

First four rules will be also validated client-side.

### Manual rendering

[](#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.

```
{form formName}
	...

	{gpspicker coords}
		{gpspicker:label lat}Latitude:{/gpspicker:label} {gpspicker:input lat}
		{gpspicker:label lng}Longitude:{/gpspicker:label} {gpspicker:input lng}
	{/gpspicker}
{/form}
```

### Search by address

[](#search-by-address)

Enabled by default, GpsPicker supports searching map by typing the address. Extra `` element will be prepended to map, enhanced by Google Places Autocomplete service.

If you like to render it manually, use `search` key:

```
{gpspicker coords}
	{gpspicker:label search /} {gpspicker:input search}
{/gpspicker}
```

You can disable/enable search feature with `enableSearch`/`disableSearch` pair of methods:

```
$form->addGpsPicker('coords', 'Coordinates:')
	->disableSearch();
```

Or in constructor:

```
$form->addGpsPicker('coords', 'Coordinates:', array(
	'search' => FALSE,
));
```

### Providers

[](#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:

```
$form->addGpsPicker('coords', 'Coordinates:')
	->setDriver(Gps::DRIVER_SEZNAM);
```

Available providers are:

#### Google

[](#google)

FeatureValueUsagedefault (manually by calling `->setDriver(Gps::DRIVER_GOOGLE)`)Search by addressyesSupported types`Gps::TYPE_ROADMAP`, `Gps::TYPE_SATELLITE`, `Gps::TYPE_HYBRID`, `Gps::TYPE_TERRAIN````

```

#### Nokia

[](#nokia)

FeatureValueUsage`->setDriver(Gps::DRIVER_NOKIA)`Search by addressnoSupported types`Gps::TYPE_NORMAL`, `Gps::TYPE_SATELLITE`, `Gps::TYPE_TERRAIN````

	nokia.Settings.set('appId', 'XXX');
	nokia.Settings.set('authenticationToken', 'XXX');

```

#### OpenStreetMap

[](#openstreetmap)

FeatureValueUsage`->setDriver(Gps::DRIVER_OPENSTREETMAP)`Search by addressnoSupported types`Gps::TYPE_ROADMAP`, `Gps::TYPE_SATELLITE`, `Gps::TYPE_HYBRID`, `Gps::TYPE_TERRAIN````

```

#### Seznam (Mapy.cz)

[](#seznam-mapycz)

FeatureValueUsage`->setDriver(Gps::DRIVER_SEZNAM)`Search by addressnoSupported types`Gps::TYPE_BASE`, `Gps::TYPE_BIKE`, `Gps::TYPE_HISTORIC`, `Gps::TYPE_HYBRID`,
`Gps::TYPE_OPHOTO`, `Gps::TYPE_TRAIL`, `Gps::TYPE_TURIST````

Loader.load()
```

###  Health Score

32

—

LowBetter than 71% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 74.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~230 days

Recently: every ~569 days

Total

18

Last Release

1082d ago

PHP version history (2 changes)v1.0.0PHP &gt;=5.3.2

v1.5.0PHP &gt;=7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/b5675b484ae0ffe8749c8ecaa4e9919a96e6c1fc804d8c13b99a90cad259be9e?d=identicon)[vojtys](/maintainers/vojtys)

---

Top Contributors

[![vojtech-dobes](https://avatars.githubusercontent.com/u/415925?v=4)](https://github.com/vojtech-dobes "vojtech-dobes (56 commits)")[![vojtys](https://avatars.githubusercontent.com/u/2284429?v=4)](https://github.com/vojtys "vojtys (7 commits)")[![marian-r](https://avatars.githubusercontent.com/u/4215517?v=4)](https://github.com/marian-r "marian-r (4 commits)")[![maliknikolaj](https://avatars.githubusercontent.com/u/22886364?v=4)](https://github.com/maliknikolaj "maliknikolaj (3 commits)")[![bazo](https://avatars.githubusercontent.com/u/181588?v=4)](https://github.com/bazo "bazo (2 commits)")[![lukyrys](https://avatars.githubusercontent.com/u/2318346?v=4)](https://github.com/lukyrys "lukyrys (2 commits)")[![jiripudil](https://avatars.githubusercontent.com/u/1042159?v=4)](https://github.com/jiripudil "jiripudil (1 commits)")

---

Tags

nettemapsFormsgps

### Embed Badge

![Health badge](/badges/vojtys-nette-forms-gpspicker/health.svg)

```
[![Health](https://phpackages.com/badges/vojtys-nette-forms-gpspicker/health.svg)](https://phpackages.com/packages/vojtys-nette-forms-gpspicker)
```

###  Alternatives

[nette/forms

📝 Nette Forms: generating, validating and processing secure forms in PHP. Handy API, fully customizable, server &amp; client side validation and mature design.

54013.2M446](/packages/nette-forms)[nette/application

🏆 Nette Application: a full-stack component-based MVC kernel for PHP that helps you write powerful and modern web applications. Write less, have cleaner code and your work will bring you joy.

44615.4M979](/packages/nette-application)[vojtech-dobes/nette-forms-gpspicker

Google Maps based picker of coordinates for Nette Framework.

2456.6k](/packages/vojtech-dobes-nette-forms-gpspicker)[contributte/recaptcha

Google reCAPTCHA for Nette - Forms

421.3M4](/packages/contributte-recaptcha)[contributte/forms-multiplier

Multiplier for nette forms

281.4M3](/packages/contributte-forms-multiplier)[kdyby/forms-replicator

Nette forms container replicator aka addDynamic

32997.7k6](/packages/kdyby-forms-replicator)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
