Download the PHP package clesson-de/silverstripe-geocoding without Composer

On this page you can find all versions of the php package clesson-de/silverstripe-geocoding. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package silverstripe-geocoding

silverstripe-geocoding

Geocoding, reverse geocoding and routing for Silverstripe CMS 6.1, backed by OpenStreetMap (Nominatim / OSRM) and Google Maps.

Features


Requirements

Dependency Version
PHP ^8.1
silverstripe/framework ^6
commerceguys/addressing ^2.1
guzzlehttp/guzzle ^7

Installation

After installation, run a database build:


Address and AddressType models

This module provides two standalone models for address management that can be used independently of — or in combination with — the clesson-de/silverstripe-contacts module.

Address

Represents a physical address. Fields: Name, AddressLine1, AddressLine2, PostalCode, City, Region, CountryCode.

A formatted Summary string (localised using commerceguys/addressing) is generated automatically onBeforeWrite. An interactive map field showing the geocoded coordinates is added via AddressExtension.

AddressType

A configurable taxonomy for address types (e.g. invoice address, delivery address). Default types can be seeded in project config:

Region dropdown API

When displaying an Address edit form, the region field uses a dynamic dropdown. The module exposes a JSON endpoint that returns subdivision options for a given country:

Requires CMS_ACCESS permission.


Configuration

Managing geocoding services in the CMS

  1. Log in to the CMS.
  2. Navigate to Settings (SiteConfig).
  3. Open the Geocoding tab.
  4. Select a map display service — choose which service provider (Google or OpenStreetMap) should render interactive maps in the CMS.
  5. Add geocoding services for each method (geocode, reverse geocode, route):
    • Use the Add button to link existing services or Add new to create a service inline.
    • Set the Quota (maximum calls per day; 0 = unlimited).
    • Drag services to change their priority order — the first service with available quota is used.
  6. Save the Settings page.

Creating a new geocoding service

  1. In the Geocoding tab, click Add new under any method section.
  2. Choose the service type: OpenStreetMap service or Google service.
  3. Fill in the form:
    • Name — a descriptive label for this service record.
    • Active — enables or disables the service.
    • API key — required for Google Maps only.
    • Base URL — overrides the default Nominatim URL (OpenStreetMap only; leave empty to use the public API).
    • OSRM base URL — overrides the default OSRM routing URL (OpenStreetMap only).
    • Rate limit (ms) — minimum wait time in milliseconds between two requests. Set to at least 1100 for Nominatim to comply with the Nominatim usage policy.
  4. Save the service.

User guide

Interactive map field

When editing an Address record in the CMS, you'll see an interactive map that displays the current coordinates (if set) and allows you to update them by clicking on the map:


Frontend assets

This module includes JavaScript and CSS assets for the interactive map field. After installation, run:

This exposes the compiled assets from client/admin/dist/ to public/_resources/silverstripe-geocoding/.

Developing frontend assets

If you need to modify the JavaScript or SCSS:

  1. Navigate to the module directory:

  2. Install Node.js dependencies (using the version specified in .nvmrc):

  3. Build the assets:

  4. Or watch for changes during development:

The .nvmrc file specifies the required Node.js version (22). Use nvm to switch to the correct version automatically.


Troubleshooting

Map shows as grey box / tiles don't load initially

Symptom: When you open a form with a MapField (especially in GridField detail forms or tabs), you see a grey box. After reloading the page, the map tiles load correctly.

Cause: The map container is loaded via AJAX, but the JavaScript initialization ran before the container appeared in the DOM.

Solution: This is automatically handled by the Entwine integration (map-entwine.js). Make sure you have:

  1. ✅ Run composer vendor-expose after installation
  2. ✅ Cleared the Silverstripe cache (?flush=all)
  3. ✅ Hard-refreshed your browser (Ctrl+Shift+R / Cmd+Shift+R)
  4. ✅ Checked the browser console for JavaScript errors

How it works: The module uses jQuery Entwine to watch for .geocoding-map-container elements. When a container appears in the DOM (including via AJAX), Entwine automatically initializes the map after a short delay (100ms) to ensure all assets are loaded.

Debug: Open the browser console and check:

See Asset loading documentation for detailed debugging instructions.


Map doesn't appear at all

✓ Checklist:

Coordinates don't save

✓ Checklist:

Coordinates are rounded / have fewer decimal places

Symptom: When you copy coordinates from Google Maps (e.g. 48.65129546574825, 9.28476328298257), they are saved with only 7 decimal places (e.g. 48.6512955, 9.2847633).

This is normal and intentional. The database uses DECIMAL(10,7) which provides 7 decimal places = ~1.1 cm accuracy. This is the industry standard for GPS coordinates and more than sufficient for address geocoding.

Google's 14+ decimal places (sub-micrometer precision) are only relevant for scientific/surveying applications. The difference is invisible on maps and has zero practical impact.

See the Coordinate precision guide for detailed explanation.


Developer documentation

Extensibility

This module is designed to be modular and extensible. You can add support for additional map providers (e.g. Bing Maps, Mapbox, HERE Maps) in your own module without modifying the core geocoding module.

How it works:

Documentation:


Using DBGeoCoordinate in your own DataObjects

Declare the field in $db using the GeoCoordinate type alias:

This creates two database columns: LocationLatitude DECIMAL(10,7) and LocationLongitude DECIMAL(10,7).

Note on precision: The 7 decimal places provide ~1.1 cm accuracy, which is the industry standard for GPS coordinates and more than sufficient for address geocoding. Services like Google Maps may return coordinates with 14+ decimal places, but the additional precision (sub-micrometer) is only relevant for scientific/surveying applications and will be automatically rounded when saved.

Add the MapField to your getCMSFields():

Access the coordinate via the composite field object:


Using the service classes in code

Retrieve a configured service record and instantiate the matching service class:

Geocoding (address → coordinates)

Reverse geocoding (coordinates → address)

Routing (start + waypoints + destination → route)


License

BSD 3-Clause License — see LICENSE.


All versions of silverstripe-geocoding with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-gd Version *
silverstripe/framework Version ^6
clesson-de/silverstripe-autocomplete Version ^1.0
commerceguys/addressing Version ^2.1
guzzlehttp/guzzle Version ^7
symbiote/silverstripe-gridfieldextensions Version ^5
dnadesign/silverstripe-elemental Version ^6
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package clesson-de/silverstripe-geocoding contains the following files

Loading the files please wait ...