-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inserting features in mapbox dataset through javascript sdk api from a static webpage without using server #4
Comments
@geohacker I think it is a good idea to briefly document your work-flow in the README file. It will help people adopt Mapbox API in their future projects. |
Hope that helps! |
Thanks @arky , @geohacker ! I have a simpler application that needs this hookup with Mapbox API. See this basic form with map input residing on github pages, see its code here. I've created an empty dataset in my mapbox account; its id is Upon form submission, I'll make my script prepare GeoJSON feature as you have done. But your server file as I understand is residing on a server running NodeJS. My form is on a simple html file on github pages. What do I have to do (as in : insert this code at the top of your page) to make it work? Specifically, what do I need to include and setup to make this command work: The top lines on your server.js are as follows. How do I translate them to my static HTML file? (wanted:
|
Crosspost : created question on gis.stackexchange : https://gis.stackexchange.com/questions/258025/form-submit-to-mapbox-dataset-via-api |
@answerquest - you're right, the code I've in this repository is expected to be run on a server and not in a browser. To do that, you'll have to include mapbox-sdk through a <script> tag. Something similar to what's recommended here - mapbox/mapbox-sdk-js#170 (comment) Hope that helps! |
Got it to work! Thanks! |
Sample code:
In html body:
Note: The accesstoken in this case needs to have the secret scope On loading page, press
Note: The code in this form will expose your secret accessToken if you put your page on the web directly. Use with caution. You can host this code in a login or password-protected page or site. One solution for encrypting static HTML page with a password : StatiCrypt |
seriously. I have the GPSlogger app. Explain how it's pushing data to your mapbox account ("as you would a child!") and what are you setting up in your mapbox account to receive it. And is it a free account or a paid account?
The text was updated successfully, but these errors were encountered: