Data Mappr

(65 KB)

54
132
Shows different catalogue entries' longitude/latitude values as pins on a Google map (maintenance status). Clicking on the pin shows the catalogue entry in a little box (as a link to the entry).

Before you can use the block you must first configure the API:
  1. Configure the Google API Key in the configuration (Admin Zone > Configuration > Setup > Composr API options > Google API)
  2. Make sure that Google Maps JavaScript API is enabled on Google's end
If you do not you may get a "Oops! Something went wrong." error and a corresponding "MissingKeyMapError" error in the browser console.

The names of the fields to take longitude/latitude from are configured inside block parameters.

Example:

Code

[block title="store locator" description="This is a Store Locator" latfield="Latitude" longfield="Longitude" catalogue="stores" width="100%" height="300px" zoom="6" latitude="24.2135" longitude="-1.4654"]main_google_map[/block]

If you use the field names of exactly "Latitude" and "Longitude" then you'll get a visual location selector when adding entries. Otherwise you'll need to manually enter the coordinates. A tool like Latitude and Longitude of a Point can help you.

It is advisable to set the field options as decimal_points=6 for your latitude and longitude fields, otherwise there will not be enough precision.

Add at least 1 entry to your catalogue with the latitude and longitude fields filled in to see the block work.

When you add the block you see various block parameters to be filled in including:
  • title – The Name of the block which will appear on screen (for example, Store Locator)
  • description – a Description of the block
  • latfield – This is the field you chose in the catalogue which has all the latitude coordinates in it
  • longfield – This is the field you chose in the catalogue which has all the longitude coordinates in it
  • catalogue – This is the name of the catalogue you chose and want to display the pins for
  • width – Defaults to 100% of the column
  • height – Defaults to 300px but can be set to how ever many pixels(px) you need it to be
  • zoom – A number between 1 and 17, the higher the number the more zoomed in the map will start at
  • latitude – The Latitude coordinates where you want the centre of the map to be when first loaded
  • longitude – The Longitude coordinates where you want the centre of the map to be when first loaded

Coordinates of the Google map centre point and zoom level are configurable. You can find the coordinates by using the option in Google Maps Labs or via a tool like Latitude and Longitude of a Point.


System Requirements / Dependencies

catalogues

Website Software Requirements

Minimum version: 11


Licence

Licensed on the same terms as Composr

Images

Rating

Unrated