Search by

arraypress / wp-mapsco-geocoding

arraypress

A PHP library for integrating with the Maps.co Geocoding API in WordPress, providing both forward and reverse geocoding capabilities with WordPress transient caching.

Package info

github.com/arraypress/wp-mapsco-geocoding

Homepage

pkg:composer/arraypress/wp-mapsco-geocoding

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

v1.0.0 2026-08-26 08:19 UTC

This package is auto-updated.

Last update: 2026-09-26 08:52:14 UTC


README

Turn an address into coordinates, and back, using Maps.co — free at low volume and no card required.

What it does

Same job as Google's Geocoding API, from a service you can use without a billing account. Maps.co is built on OpenStreetMap data: less precise than Google on individual buildings, entirely adequate for a town, a postcode or a delivery radius.

The response is an object with named methods, and lookups are cached, since an address does not move.

Features

  • Turn a written address into latitude and longitude
  • Turn coordinates back into a display address
  • Get map links for Google, Apple, Bing and OpenStreetMap without building URLs
  • Read the OpenStreetMap type and id behind a result
  • Cache lookups for as long as suits, and clear one on demand
  • Start without a billing account, which Google's equivalent requires

Installation

composer require arraypress/wp-mapsco-geocoding

Quick start

Geocode an address when it is saved:

use ArrayPress\MapsCo\Geocoding\Client;

$client = new Client( $api_key );
$result = $client->geocode( 'Buckingham Palace, London' );

if ( ! is_wp_error( $result ) ) {
	update_post_meta( $id, '_lat', $result->get_latitude() );
	update_post_meta( $id, '_lng', $result->get_longitude() );
}

And a link somebody can actually open:

echo esc_url( $result->get_google_maps_url() );

What it does not do

It will not reliably find a specific flat in a building, or a new-build street. For that, Google's Geocoding API is worth the billing account — arraypress/wp-google-geocoding is the same shape.

Requirements

  • PHP 8.3 or later
  • WordPress 7.1 or later
  • A Maps.co API key (free tier, no card)

License

GPL-2.0-or-later