Setting Up Your App
How you set up and structure your Geovisualization apps is dependent on its nature. This guide shows you our recommended 'best practice' development process, possible file structure and explains the role of each file.
You use the Geovisualization REST API to set up your datasets and queries and we recommend Postman (see Using Postman), but you can use any similar tool.
To create an app, or modify an existing one, use the following steps as a guideline:
- Upload your data with the Geovisualization REST API (see Managing your Data) and get a dataset ID.
- Define a query on your dataset with the Geovisualization REST API query language (see Define Query). You can use sample query definitions as guidance found in the Geovisualization code examples. We recommend you store your query definition(s) in a file (for example, query.json) in your app file structure.
POSTyour query JSON code to the Geovisualization REST API (see Creating a Query) and get the query ID.
- Publish your query to make your visualization publicly accessible (see Publishing a Query).
There are a number of files recommended for a Geovisualization application, none are required, but will help you organize the structure and function of your application.
[root] | |----- [src] | | | |----- index.css | |----- index.js | |----- index.html |----- query.json
- An index.js file, in which you define the main logic of the visualization. The query ID and the dataset ID are included in this file.
index.cssfile, in which you define the styles for the map container.
- Your app references the query by its ID in index.js, but a query.json file that contains the query definition is useful to include for easy access and modification of the query code.