Maps

With the Maps Locator module your can convert your entries in searchable locations. The Module comes with a default 1 location fieldtype, but when you have installed the Maps Fieldtype, the module save the locations automatically from out your Maps fieltype. This way you can have multiple locations per enty.

Documentation versions

How it works

Using the Maps Locator module is very easy and very powerfull to create for example a store locator. There are 2 options to do that;

What those 2 options does, is just saving your locations to a readable format (latlng) in your database. Later we can just use any method, that comes with the Gmaps Data module to get your result out of the database with the assigned entry.

Limitations

Because we are using geocoding to get the right latlng, there is a limitation. The Maps Module will try to handle this very good, but it is not always working due some strict rules from Google. So keep in mind, that when you have 100 addresses or more, there is a change that not all addresses are saved correctly. (https://developers.google.com/maps/documentation/geocoding/usage-limits)

Reverse geocoding

When you add a latlng coordinate to your field, of if that is coming from the maps fieldtype, Maps locator will try to reverse geocode this latlng. Meaning that is searching for an address for this latlng. Most of the time this address is not on this location and there for you will get a different latlng coordinate. If you are working with strict coordinates and you are sure that you have entered a valid coordinate, you can disable this behaviour in the Maps Locator CP --> Reverse Geocode latlng setting.

Installation

Prerequisites

Make sure your system meets the minimum requirements:

Installation Instructions

Update instructions

version 3.x

This version is a major update that can only be installed on top of version 2.x or higher. See https://addons.reinos.nl/news/maps-suite-3

License

For every paid addon you need to validate your license in order to activate the module.

On a local environment, like *.dev *.local *.localhost *.test the license is valid for testing and building a new or existing sites. For every other domain, you need to have a valid license.

Process of validating

Once installed, you will asked to enter your license key. When you entered a valid license you can hit the "Save license" button. This will start validating your license and will redirect you to addons.reinos.nl to login into your account. You can also register a new account in this process.

Control panel overview

Once logged in, you are asked to use your current account or to login with another one.

Control panel overview

Using the current logged in account, the server will check all info related to your license and once valid, it will redirect you back to your site where you see either a success message or an error message.

Control panel overview

License field

This module is using a license field to check if the license for the module is valid or not. On addons.reinos.nl you can check your license and add your valid domains.

Control panel overview

In the Module CP you can enter then your license Control panel overview

When you enter a wrong license, the module will not work and it shows you an warning Control panel overview

Invalid license

Sometimes it happens that the license system says you have an invalid license. When this happens, make sure you have entered your domain url in your account, next to your license on addons.reinos.nl.

If this will not fix your license problem, please contact us on https://addons.reinos.nl/support

Migration

Database

Migrate from the old Gmaps Data to maps_locator is very easy. In the maps_locator CP section there is a page that called Migration.

Here you can migrate the Database and the fieldtype data to the maps_locator. After the migration you need to disable the Gmaps Data module manual.

Template

Converting the template tags is very easy, just search the name gmaps_data and rename it to maps_locator.

For example:

{exp:gmaps_data:search_form}

becomes

{exp:reinos_maps_locator:search_form}

important: before starting, make sure you make a backup of your old data, in case of failure.

Fieldtype template tag

To get the location values from your entry.

Example

{exp:channel:entries dynamic="no" entry_id="2"}
    {your_field_type_name}
        address: {your_field_type_name:address}<br>
        postal_code: {your_field_type_name:postal_code}<br>
        city: {your_field_type_name:city}<br>
        country: {your_field_type_name:country}<br>
        lat: {your_field_type_name:lat}<br>
        lng: {your_field_type_name:lng}<br>
    {/your_field_type_name}
{/exp:channel:entries}

Tag Variables

Below are the Tag Variables. Those Variables can be used inside the tag described above.

address

{your_field_type_name:address}

postal_code

{your_field_type_name:postal_code}

city

{your_field_type_name:city}

country

{your_field_type_name:country}

state

{your_field_type_name:state}

lat

{your_field_type_name:lat}

lng

{your_field_type_name:lng}

Current search location tag

Get the current searched location. (used with search_result tag)

The tag

{exp:reinos_maps_locator:current_search_location}

Tag Parameters

Below are the Tag Parameters. Those parameters can be used in the tag described above

search_id

set the search_id hash. This way the module will get this hash instead of using the hash from the url.

sort="search_id"

Tag Variables

lat

{lat}

lng

{lng}

city

{city}

street_name

{street_name}

street_number

{street_number}

country

{country}

country_code

{country_code}

Query tag

Simply query your entry locations

The tag

{exp:reinos_maps_locator:query}

Tag Parameters

Below are the Tag Parameters. Those parameters can be used in the tag described above

lat

the Langitude

lat=""

lng

lng=""

city

city=""

street_name

street_name=""

postal_code

postal_code=""

country

country=""

country_code

country_code=""

Tag Variables

Below are the Tag Variables. Those Variables can be used inside the tag described above.

entry_id

{entry_id}

lat

{lat}

lng

{lng}

city

{city}

street_name

{street_name}

street_number

{street_number}

postal_code

{postal_code}

country

{country}

country_code

{country_code}

Example

{exp:reinos_maps_locator:query country_code="nl"}
    {if no_results}
        No result
    {/if}

    entry_id: {entry_id}<br>
    lat: {lat}<br>
    lng: {lng}<br>
    city: {city}<br>
    street_name: {street_name}<br>
    street_number: {street_number}<br>
    postal_code: {postal_code}<br>
    country: {country}<br>
    country_code: {country_code}<br>
{/exp:reinos_maps_locator:query}

Radius tag

Show locations based on a radius

The tag

{exp:gmaps_data:radius}

Tag Parameters

Below are the Tag Parameters. Those parameters can be used in the tag described above

location

locations=""

metric

set the type of metrics km or mile

metric="km"

radius

radius=""

sort

Order by is by radius

sort="asc"

limit

For use with the paging tags https://docs.expressionengine.com/latest/templates/pagination.html

limit=""

Tag Variables

Below are the Tag Variables. Those Variables can be used inside the tag described above.

entry_id

{entry_id}

lat

{lat}

lng

{lng}

city

{city}

street_name

{street_name}

street_number

{street_number}

postal_code

{postal_code}

country

{country}

country_code

{country_code}

Example

{exp:reinos_maps_locator:radius location="amsterdam" radius="50"}
    {if no_results}
        No result
    {/if}

    entry_id: {entry_id}<br>
    radius: {radius}<br>
    lat: {lat}<br>
    lng: {lng}<br>
    city: {city}<br>
    street_name: {street_name}<br>
    street_number: {street_number}<br>
    postal_code: {postal_code}<br>
    country: {country}<br>
    country_code: {country_code}<br>
{/exp:reinos_maps_locator:radius}

Search form tag

Search your location via user form

The tag

{exp:reinos_maps_locator:search_form}

Tag Parameters

Below are the Tag Parameters. Those parameters can be used in the tag described above

search_id

set the search_id hash. This way the module will get this hash instead of using the hash from the url.

search_id=""

metric

set the type of metrics km or mile

metric="km"

channel

Give the channel(s) to search. separate with a pipeline (|) for multiple channels.

channel=""

location_field

Set the location field name of your input field of your form. This will be used to search against the entries.

location_field=""

radius_field_max

Set the radius max field name of your input field of your form.

radius_field_max=""

search_type_field

Set the search type field, that hold the values. radius locality admin_level sub_locality

search_type_field=""

search_category_field

the category field that holds the categories (names or ID) to select.

search_category_field=""

result_url

set the url of your result page

result_url=""

status

Set the entry status search.

When you want to search for more than one status, use a pipeline | as separator

status="open"

Tag Variables

Below are the Tag Variables. Those Variables can be used inside the tag described above.

location

the location value

{location}

radius

the radius value

{radius}

search_type

the search_type value

{radius}

search_category:id

The Category id you are searching

{search_category:id}

search_category

If searching multiple categories, this holds a loop of data

{search_category}
    {search_category:search_category:id}
{/search_category}

Example

{exp:reinos_maps_locator:search_form
    metric="km"
    channel="channel_1|channel_2"
    location_field="location_field"
    radius_field_max="radius_field_max"
    search_type_field="search_type_field"
    result_url="locations/result"
}
    <label>Location to search with (this location will be geocoded</label><br>
    <input type="text" name="location_field" value="{location}"/> 

    <br><br>

    <label>Radius (only uses when the search_type is set to 'radius')</label><br>
    <select name="radius_field_max">
        <option {if radius == 20}selected{/if} value="20">20</option>
        <option {if radius == 50}selected{/if} value="50">50</option>
        <option {if radius == 100}selected{/if} value="100">100</option>
        <option {if radius == 5000}selected{/if} value="5000">5000</option>
    </select>

    <br><br>

    <label>Search type</label><br>
    <select name="search_type_field">
        <option {if search_type == 'radius'}selected{/if} value="radius">Radius</option>
        <option {if search_type == 'locality'}selected{/if} value="locality">Within a City</option>
        <option {if search_type == 'admin_level'}selected{/if} value="admin_level">Within a state or province</option>
        <option {if search_type == 'sub_locality'}selected{/if} value="sub_locality">Within a city_district</option>
    </select>

    <br><br>

    <input type="submit"/>
{/exp:reinos_maps_locator:search_form}

Search result tag

Show your result from the search_form method.

The tag

{exp:reinos_maps_locator:search_result}

Tag Parameters

Below are the Tag Parameters. Those parameters can be used in the tag described above

search_id

set the search_id hash. This way the module will get this hash instead of using the hash from the url.

search_id="search_id"

sort

Order by is by radius

sort="asc"

limit

For use with the paging tags https://docs.expressionengine.com/latest/templates/pagination.html

limit=""

status

Set the entry status search. This will override the default that has been set in the {exp:reinos_maps_locator:search_form} tag.

When you want to search for more than one status, use a pipeline | as separator

status="open"

Tag Parameters DEFAULT

Below is a set of params that can be used when you need to show some default entries.

(If it returned no result, it will not trigger the no_result catch block)

default:show_all

Enable or disable the default results

default:show_all="no"

default:channel

Give the channel(s) to search. separate with a pipeline (|) for multiple channels.

default:channel="channel_1|channel_2"

default:location

Enter a location/address from where the search is started.

default:location="new-york"

default:metric

set the type of metrics km or mile

default:metric="km"

default:search_type_field

Set the search type field, that hold the values. radius locality admin_level sub_locality

default:search_type_field=""

default:radius

default:radius="1000"

Tag Variables

Below are the Tag Variables. Those Variables can be used inside the tag described above.

entry_id

{entry_id}

lat

{lat}

lng

{lng}

Calculated radius

{radius}

Posted radius by the user

{post_radius}

admin_level_n:name

indicates the number of order civil entity below the country level. Within the United States, these administrative levels are states. Not all nations exhibit these administrative levels.

{admin_level_1:name} // prints the first admin level, for us this is the state
{admin_level_2:name} // prints the second admin level, for us this is the state

city

{city}

street_name

{street_name}

street_number

{street_number}

postal_code

{postal_code}

country

{country}

country_code

{country_code}

absolute_results

{absolute_results}

Example

{!-- include the Gmaps module and show a default map with the center on holland and a max zoom of 15 --}
{!-- (otherwise the zoom would be max when placing the markers)--}
{exp:gmaps:init}
{exp:gmaps:geocoding address:center="holland" max_zoom="15"}

{exp:reinos_maps_locator:search_result}
    {if no_results}
        No result
    {/if}

    entry_id: {entry_id}<br>
    radius: {radius}<br>
    lat: {lat}<br>
    lng: {lng}<br>
    city: {city}<br>
    street_name: {street_name}<br>
    street_number: {street_number}<br>
    postal_code: {postal_code}<br>
    country: {country}<br>
    country_code: {country_code}<br>

    {!-- Data from the native maps_locator fieldtype --}
    {exp:channel:entries dynamic="no" entry_id="{entry_id}"}
        {maps_locator_test}
            address: {maps_locator_test:address}<br>
            postal_code: {maps_locator_test:postal_code}<br>
            city: {maps_locator_test:city}<br>
            country: {maps_locator_test:country}<br>
        {/maps_locator_test}
    {/exp:channel:entries}

    {!-- place markers with the Gmaps module --}
    {exp:gmaps:add_marker map:id="1" latlng="{lat},{lng}" fit_map="yes"}

{/exp:reinos_maps_locator:search_result}

Changelog

3.2.2 (not-yet-released)

3.2.2 (11-10-2023)

3.2.1 (27-10-2021)

3.2.0 (25-08-2021)

3.1.0 (09-03-2021)

3.0.1 (29-12-2020)

3.0.0 (02-12-2020)

Breaking changes See https://addons.reinos.nl/news/maps-suite-3

You need at least v2.0.0 or higher to upgrade to this version. Inside all v3.x.x releases, there is a v2.x.x. release. You can use this version to upgrade to the latest v2.x.x and after that upgrade you are good to go to update to v3.x.x. Remember, its just replacing files and hit the upgrade button. There is no other action required, it's that simple (but required).

2.2.3 (02-12-2020)

2.2.2 (12-12-2019)

Bugfix: where wrong logging service was called

2.2.1 (12-12-2019)

2.2.0 (30-10-2019)

2.1.0 (24-10-2019)

2.0.3 (11-08-2019)

2.0.2 (29-07-2019)

2.0.1 (08-06-2019)

2.0.0 (21-05-2019)

*Note: There is a change you will have to validate the license again

\Note:** Because the module has been renamed with a prefix reinos_ there is an update path by simply add the new update to your site and install it. By installing the module, you are disabling the old module that can be deleted afterward. Also note that you have to rename the module calls and hooks with a prefix reinos_

See this article about the rename https://addons.reinos.nl/news/modules-renamed

1.1.1 (06-03-2019)

1.1.0 (19-12-2018)

1.0.0 (30-10-2018)