A simple map-based survey form for collecting map based survey responses for the 2026 Manhattan Borough President convention. Built with Mapbox GL JS and Google Apps Script.
index.html- The form page with Mapbox map and survey questionsapps-script.js- Google Apps Script code for the backend
-
Create a new Google Sheet
-
Add these headers in Row 1:
- A:
Timestamp - B:
Latitude - C:
Longitude - D:
Map Type - E:
Pin Type - F:
Story - G:
Name - H:
Email
- A:
-
Go to Extensions → Apps Script
-
Delete any existing code and paste the contents of
apps-script.js -
Click Deploy → New deployment
-
Select Web app as the type
-
Set:
- Execute as: Me
- Who has access: Anyone
-
Click Deploy and authorize when prompted
-
Copy the Web app URL
Open index.html and update these two values near the top of the <script> section:
// Replace with your Mapbox access token
const MAPBOX_TOKEN = 'YOUR_MAPBOX_ACCESS_TOKEN';
// Replace with your Google Apps Script web app URL
const APPS_SCRIPT_URL = 'YOUR_APPS_SCRIPT_URL';- Log in to Beta's Mapbox account at https://account.mapbox.com/
- Navigate to the Account → Tokens
- Copy the default public token (or create a new one)
- Push
index.htmlplus any other assets to a GitHub repo - In the repo settings, enable GitHub Pages (choose the branch and folder where
index.htmlis located) - Your form will be live at https://betanyc.github.io/mbp-convention-form/
The map is currently bounded to Manhattan. To change this, edit the manhattanBounds array:
const manhattanBounds = [
[-74.0479, 40.6829], // Southwest corner [lng, lat]
[-73.9067, 40.8820] // Northeast corner [lng, lat]
];The dropdown options are defined in the pinTypeOptions object. Add, remove, or modify as needed.
The form uses CSS custom properties (variables) at the top of the <style> block. Adjust colors, fonts, etc. there.
- The form uses
mode: 'no-cors'for the fetch request because Google Apps Script requires this. This means we can't read the response, but submissions still work. - Responses are stored in Eastern Time (America/New_York). Change the timezone in
apps-script.jsif needed. - If you update the Apps Script code, you must create a new deployment for changes to take effect.