Skip to content

Commit

Permalink
Updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
Tam committed Nov 30, 2017
1 parent 8788d6d commit 77f1e75
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
![Simple Map](resources/banner.jpg)

# Simple Map
A beautifully simple Google Map field type for **Craft 3**. Full localization support, compatible with Matrix, supports
A beautifully simple Google Map field type for **Craft 3**. Full localization support, compatible with Matrix & [CraftQL](https://github.com/markhuot/craftql), supports
searching by location and sorting by distance.

[Click here for the **Craft 2.5** version.](https://github.com/ethercreative/simplemap/tree/v2)
Expand Down Expand Up @@ -90,4 +90,20 @@ var map = new mapboxgl.Map({
]
});
</script>
```

### Converting an address to Lat/Lng
If you need to convert a string address to a Lat/Lng you can do so using the
`craft.simpleMap.getLatLngFromAddress($addressString[, $country])` variable.
An example of this would be wanting to convert a customers delivery address to a
Lat/Lng, to display it on a map.

- `$address` - The string address you want to convert.
- `$country` - *Optional.* Restrict the conversion to a specific country (useful for non-specific searches, i.e. town name). Must be valid [2-letter ISO code](https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) (recommended), or full country name.

```twig
{% set location = craft.simpleMap.getLatLngFromAddress("Ether Creative, Maidstone", "GB") %}
{{ location.lat }}
{{ location.lng }}
```

0 comments on commit 77f1e75

Please sign in to comment.