All Projects → benjamminf → Craft Coordinates

benjamminf / Craft Coordinates

Licence: mit
A twig filter for Craft CMS that gets the latitude and longitude from an address

Projects that are alternatives of or similar to Craft Coordinates

Geomate
GeoMate is a friend in need for all things geolocation. IP to geo lookup, automatic redirects (based on country, continent, language, etc), site switcher... You name it.
Stars: ✭ 19 (-29.63%)
Mutual labels:  craftcms, craft-plugin, geolocation
craft-recipe
A comprehensive recipe FieldType for Craft CMS that includes metric/imperial conversion, portion calculation, and JSON-LD microdata support
Stars: ✭ 23 (-14.81%)
Mutual labels:  craftcms, craft-plugin
Craft3 Templateselect
A fieldtype that allows you to select a template from the site templates folder.
Stars: ✭ 18 (-33.33%)
Mutual labels:  craftcms, craft-plugin
Vanillaforums
DEPRECATED Single Sign On plugin for VanillaForums/jsConnect and CraftCMS
Stars: ✭ 14 (-48.15%)
Mutual labels:  craftcms, craft-plugin
craft-retour
Retour allows you to intelligently redirect legacy URLs, so that you don't lose SEO value when rebuilding & restructuring a website
Stars: ✭ 32 (+18.52%)
Mutual labels:  craftcms, craft-plugin
craft-entriessubset
Craft field type plugin that extends the core Entries field type to give extra settings
Stars: ✭ 27 (+0%)
Mutual labels:  craftcms, craft-plugin
Imager Craft
This plugin has been DEPRECATED. Check out Imager X instead.
Stars: ✭ 351 (+1200%)
Mutual labels:  craftcms, craft-plugin
craft.doxter
Markdown editor and parser for Craft CMS
Stars: ✭ 80 (+196.3%)
Mutual labels:  craftcms, craft-plugin
Craft Neo
A Matrix-like field type for Craft CMS that uses existing fields
Stars: ✭ 387 (+1333.33%)
Mutual labels:  craftcms, craft-plugin
Awesome
A collection of awesome Craft CMS plugins, articles, resources and shiny things.
Stars: ✭ 449 (+1562.96%)
Mutual labels:  craftcms, craft-plugin
Falcon
Enables Xkey / Hash-Two / Surrogate Key caching with Craft 2.x. Very experimental.
Stars: ✭ 14 (-48.15%)
Mutual labels:  craftcms, craft-plugin
Plugin Installer
Composer installer for Craft CMS plugins
Stars: ✭ 22 (-18.52%)
Mutual labels:  craftcms, craft-plugin
routemap
DEPRECATED Returns a list of Craft/Vue/React route rules and entry & asset URLs for ServiceWorkers from Craft entries
Stars: ✭ 27 (+0%)
Mutual labels:  craftcms, craft-plugin
Commercemailer
ARCHIVED: For Craft Commerce. Makes it easy to create forms for sending carts, products and orders by email.
Stars: ✭ 8 (-70.37%)
Mutual labels:  craftcms, craft-plugin
transcoder
DEPRECATED Transcode videos to various formats, and provide thumbnails of the video
Stars: ✭ 24 (-11.11%)
Mutual labels:  craftcms, craft-plugin
Contact Form
Add a simple contact form to your Craft CMS site.
Stars: ✭ 294 (+988.89%)
Mutual labels:  craftcms, craft-plugin
craft-plugin-mix
Helper plugin for Laravel Mix in Craft CMS templates
Stars: ✭ 50 (+85.19%)
Mutual labels:  craftcms, craft-plugin
dospaces
DigitalOcean Spaces integration for Craft CMS
Stars: ✭ 31 (+14.81%)
Mutual labels:  craftcms, craft-plugin
Seomatic
DEPRECATED A turnkey SEO implementation for Craft CMS 2.x that is comprehensive, powerful, and flexible
Stars: ✭ 366 (+1255.56%)
Mutual labels:  craftcms, craft-plugin
Element Api
Create a JSON API/Feed for your elements in Craft.
Stars: ✭ 493 (+1725.93%)
Mutual labels:  craftcms, craft-plugin

Coordinates

Twig filters for Craft CMS that finds the latitude and longitude from an address.

The plugin fetches the coordinates through the Google Maps API without the need for an API key. Simply install the plugin and being using it.

How to use

{{ 'Flinders St, Melbourne VIC 3000' | coordinates }}
{# Outputs '-37.8182609,144.9648863' #}

{{ 'flinders STREET melbourne, Victoria, 3000' | formatAddress }}
{# Outputs 'Flinders Street, Melbourne VIC 3000, Australia' #}

{% set address = addressData('Flinders St, Melbourne VIC 3000') %}
{{ address.coordinates }} {# Outputs '-37.8182609,144.9648863' #}
{{ address.formattedAddress }} {# Outputs 'Flinders Street, Melbourne VIC 3000, Australia' #}
{{ address.latitude }} {# Outputs -37.8182609 #}
{{ address.longitude }} {# Outputs 144.9648863 #}
{{ address.url }} {# Outputs 'https://www.google.com/maps/place/Flinders...' #}
{% for label, part in address.parts %}
	{{ label }} {# Outputs 'country' | 'state' | ... #}
	{{ part }} {# Outputs 'Australia' | 'Victoria' | ... #}
{% endfor %}

API

Templates

Filter Description
coordinates(separator=',') or coords(sep...) Returns the latitude and longitude, separated by a custom string.
latitude or lat Returns the latitude as a number.
longitude or lng Returns the longitude as a number.
formatAddress Returns a standardised address format.
Function Description
addressData(address) Returns a coordinates model instance from an address

CoordinatesModel

TODO

Changelog

v1.3.0

  • Added Added ability to extract parts of an address (country, state, etc.)
  • Added Added URL parameter to coordinates model that links an address or set of coordinates to Google Maps
  • Fixed Fixed name of addressData function

v1.2.0

  • Added Added Twig functions for getting center and average coordinates for a list of coordinates
  • Improved addressData() now returns a Coordinates model rather than a plain object
  • Improved Refactored code and improved API

v1.1.0

  • Added Added shorthand filters lat, lng, and coords, as well as a addressData() function
  • Added Added release feed to the plugin
  • Improved Improved internal caching so there is no need for {% cache %} tags
  • Improved Refactored code

v1.0.1

  • Improved Added minor caching so that address data is only requested once per template render.

v1.0.0

Initial release

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].