Import a Dataset
WP Mapbox GL JS allows you to manage and update your datasets directly from within WordPress. It also allows you to create each feature of a dataset as a post that you can make visible to users, or import an entire dataset as one post. This can be particularly useful for websites that list individual map features, like real estate sites.
In order to import a dataset, first, you must create your dataset in Mapbox and save it there. See more at Mapbox about dataset management.
Once you’ve made a dataset inside your Mapbox account (and assuming this is the same account for which you got your access token for WP Mapbox GL JS), you will be able to do an import.
Make sure you have entered your secret token and username: we need these in order to get your dataset information from Mapbox.
Once you’ve done that, go to WP Mapbox > WP Mapbox Tools in the left-hand side of the WordPress admin, and you will come to a settings page like the one pictured below.
On the left-hand side of the page, you’ll see the Import Dataset to WP box. In here are a few options.
First, if you’ve entered all your information correctly, you’ll see datasets appear when you click the Select that says “(no dataset selected”). If there is just an empty list, you may have entered your token incorrectly. Pick a dataset.
Import all features into one post: this option is checked by default. This will import all of your dataset’s features into a single GL JS Maps post in WordPress, meaning that the dataset will mirror exactly what is showing in your post. Do this if your want your dataset to be managed entirely in one post.
If you uncheck this option, each feature will be created as its own post. This is useful if you want to manage each feature separately, or create a different post for every feature in your dataset.
Update existing posts: This option is useful for if you have updated information in your Dataset for a number of features that you have already imported into WP Mapbox GL JS Advanced. Please note that you must not have completely deleted and re-imported features; Mapbox assigns unique IDs to each feature in a dataset, and a complete re-import will cause those unique IDs to be lost, and your features in WP Mapbox GL JS Advanced will not be able to update properly.
As long as the IDs still match between your features and your dataset, checking this option will update all of your posts will the latest information from the selected dataset.
These options and feature are quite advanced, so please get in touch with us if you have questions or are confused about the functionality.