Beautiful Maps - Mapbox
  • Introduction
    • 👋Welcome
    • Key use cases
    • Key features
    • Demo apps
  • Getting Started
    • Registering for a Mapbox account
    • Install the plugin
    • Adding the access token
    • Adding a map to your app
  • Loading a Map
    • Selecting a default location
    • Setting zoom levels
    • Setting a map style
    • Adding controls to a map
  • Loading Markers
    • Structuring your database for markers
    • Adding multiple markers
    • Adding a single marker
    • Adding popups to markers
    • Using custom icons
    • Changing marker on hover
    • Removing markers from a map
    • Trigger an action when marker is clicked
  • Geolocation
    • Show the user's current location
  • Drawing Mode
    • Drawing shapes on a map
    • Saving drawings
    • Loading drawings
  • Route Navigation
    • Adding navigation
Powered by GitBook
On this page
  1. Loading Markers

Structuring your database for markers

PreviousAdding controls to a mapNextAdding multiple markers

Last updated 4 months ago

You will need valid latitude and longitude coordinates for each location you want to add a marker for. You will use these coordinates in the 'Longitudes' and 'Latitudes' fields in the 'Add List of Markers' or 'Add Single Marker' action:

There are two ways you can pass values through to the 'Longitudes' and 'Latitudes' fields:

  1. Get the values from saved locations in your database

  2. Get the values from an external API (like Google Places)

If you're getting the values from your database, you can create a data type called 'location' and add a longitude and latitude field to it. Check out the custom data type we created for the plugin demo app below:

Please note that not all the fields in the above 'Location' data type are required, but the 'Latitude' and 'Longitude' fields are.

You can add locations to your database by:

  • Uploading a csv file

  • Adding locations from your app (or letting users do this)

Video tutorial

You can watch the below video tutorial to see an example of how to setup your database and allow users to add locations. The relevant section is from 04:02 to 16:54.