Knack makes it easy to add new, or use existing, records in your database to create a Map Directory you can display in your app.
This article will walk you through the steps to create an app much like our Store Locator template app here: https://www.knack.com/store-locator-online-database/
Create a Database of Location Records
There are two options to add new records to your database to be used in a map view. You can either add them manually one at a time or you can import a spreadsheet (.csv) adding several records at once.
Manually Add Records to your Database
Using the Store Locator example, the first step is to create a Stores object and add the necessary fields. You must use one address field:
To add records to your Stores object, click the Records tab at the top of the page.
Then click the Add Record button and use the form to enter a new Store record:
Each new store record will appear in the records section of your Stores object.
Import Location Records From a Spreadsheet
You can quickly and easily bulk import new store location records using a correctly formatted .CSV file. Click here to learn more on formatting and importing your .CSV file.
Knack Tip The spreadsheet must contain your address data in separate columns.
Example: Street, City, State and Zip Code will each need to have a separate column; during the import setup, you will assign each column to the Address Field type in your Stores object.
To import your location records and create your Stores object, click “+ADD” next to the Objects in your database:
Choose the second tab to import a spreadsheet and click “Upload CSV”:
Click Next to create your column fields. Note that you will need to assign each column of your address data to the Address field:
When you have prepared the columns for import, click Submit Import to begin the import process.
A successful import should result in a Stores object with all of your records:
Create A Map To Display Your Locations
Once you have a database of store locations you can now build the live app to display these records with a map.
Add Map View in Pages Using New Page Wizard
Click on the Pages tab from the top left to begin.
There are two ways you can add a map view. You can use the “new page” wizard to setup a new map page. You may also add a map view to an existing page. If you have no pages, you'll default to add a new page:
First, let’s look at adding a map using the New Page wizard. Click “+ADD” next to ALL PAGES. Select the Stores object and the Map view. Name the page and save:
You should see a map view in your new page:
Edit additional settings for the map view by clicking the gear icon to open the map in Edit mode.
Add Map View to Existing Page Using “Add View”
If you have a page you would like to add a map to, click the Map option at the top of the page.
Choose the “Stores” object, click Add map and then Add view:
Viewing and Embedding Your App
When ready to view your map, hover over the eye icon in the upper right hand corner of the builder and select the page your map is on. This will open your map in a new window. You will see a map/store locator like the one below:
Along with viewing your map at the knack.com domain, you can also embed your map in your own website. This way the map will look seamlessly integrated with your own website.