Most of the time, you will be presenting a map in order to guide the user to a specific location. You can add a variety of vector data to your map, which can be markers if you want to show a POI (point of interest) to the user; lines, which represent a route from one location to another; and polygons, which can be used if you want to highlight an entire area.
There are a number of things that we can do with vector data in Mapbox. Here are a few of them.
Click on Data.
Click on Marker and then click anywhere on the map. A marker will drop. You can adjust the marker's position by dragging it and dropping it at a different location.
Add any title you like on the marker.
For the description, you can use not only plain text, but also the
<a>tags. Try adding the following code as the description:
Here is the location I told you about. Check out the images. More information <a href="http://www.wikipedia.com">here.</a> <img src="http://lorempixel.com/400/200/city/"></img>
Click on the Symbol tab. Here, you can select an icon for your marker. Some personality is never bad!
The last tab is Lat/Lon (Latitude/Longitude). You can type in the exact coordinate if you feel so inclined.
Click on the Data tab.
Click on Line and start the line by clicking anywhere on the map.
When you move the mouse, you will notice that Mapbox Editor shows you a dashed line; click on the next point of the map.
You can continue clicking and expanding your path as long as you wish. To complete the line, click on the last point again.
After you have completed the line, you can still modify each point by simply selecting a point and dragging it to a different location. If you click between two points, Mapbox Editor will create a new point.
Give your line a title and a description if you wish:
There are times when you need to pinpoint a specific area to the user. While you can somehow archive this to an extent by enclosing the area using lines, there is a better and easier way, which is to use polygons:
Click on the Data tab.
Click anywhere in the map to start drawing the polygon.
You can add a title and description if you wish.
At the Stroke tab, you can select a color, the line width, and the opacity of the outline, as with lines.
You can also select a fill color as well as the opacity of the filled color:
Simply select the hand tool and the item you want to adjust.
Mapbox Editor displays the properties of the selected objects and you can modify any of them, such as the title, description, or colors.
This would be tedious if we wanted to create several hundred or even thousands of them. The import feature of Mapbox Editor does exactly this. It allows us to import several well-known file formats, such as GeoJSON, CVS, KML, and GPS. Most GIS software, organizations, and services out there are able to export in one of these formats; they are used widely in the GIS and web-development landscape all over the world.
It's probably a good time to explain what these formats are:
CSV: This is a format commonly used in popular applications, such as Excel. It's actually a comma-separated format, and in order to import a CVS file into Mapbox Editor, it requires at least a latitude and longitude column.
Each file can contain multiple layers. By layer, we mean multiple features that are grouped together.
We will import a GeoJSON file that contains earthquake data for the last seven days by performing the following steps:
Start a new project.
Click on Discard Palette to choose a preset style, or style your map from scratch if you prefer.
Ensure that the hand tool is selected. Directly below it, you will see Draw or import .geojson, .cvs, .kml, or .gps files. Click on import.
You will be greeted with the Import features dialog box. The provided GeoJSON file contains many different fields, such as the earthquake's magnitude, time, place, and so on. We can specify which of these fields will be displayed in the title and description. Ensure that Title is selected and select mag (magnitude) as the title field:
In the Style tab, select your preferred color and marker size.
In the Symbol tab, select any symbol you prefer.
Click on Finish importing:
You can access imported data by clicking on the hamburger icon on the data screen next to the polygon button. You will be presented with a list of every feature you imported. This section is composed of two tabs: the first one lists the features, and the other lists the layers. GeoJSON and KML are formats that can contain features grouped into multiple layers:
Clicking on an item in the featured list allows us to edit it. We can change the title, description, color, size, and icon of the feature where available, as different types of feature have different attributes that we can modify.
Clicking on the trash can icon next to an item allows us to delete these specific features.