Visual API Overview
The Visual API allows you to create beautiful maps quickly and easily: render complex boundaries, lines, points, and labels to highlight the information in sophisticated ways. You can:
- Fully specify colors, transparency, weights, fills, sizes, icons
- Dynamically specify styles based on data to create data-driven thematic maps
- Hide extraneous elements with filters
- Overlay rendered images on your choice of base maps and/or mapping services
- Composite multiple layers of information that answer your specific questions
The Visual API provides two web services: a tiling service, and EasyMap. The tiling service is the core of the API; EasyMap is a rapid prototyping tool for making maps built on the tiling service. The Mapfluence Javascript API provides convenience methods for creating layer styles and plugging the styling API into other web mapping frameworks.
Table of Contents
Map Tiles
You can use the Visual API without knowing all the gory details, but if you are new to maps, it is useful to understand how the maps are assembled. At its core, the Visual API provides map tiles -- geographically referenced images -- which a mapping framework stitches together to create a seamless map. The popular mapping frameworks (Bing Maps, Google Maps, OpenLayers, etc) accept a base URL for a tile, then append the proper tile coordinates to assemble the map as a seamless quilt in your browser.
The Visual API's tile service responds to requests for individual tiles which include:
- Styling directives
- Map coordinates
In most applications, a mapping framework takes care of the coordinates and you only need to provide the styling directives. EasyMap does just that: specify the styling, and the mapping framework. You can then use the EasyMaps source code as a template for your own map.
Map Styling
When using the tiling service or EasyMap, the styling directives are encoded in the URL. You specify:
- One or more Layer Definitions
- Optionally, a background color
To generate a tile to overlay on another base map, you use the default background color (transparent); otherwise, you specify an RGBA color value.
Layer Definitions
A layer definition specifies:
- What to draw (countries, roads, airports, etc),
- The Drawing method:
- simple - all the same
- theme - different styling based on a numeric attribute
- class - different styling based on a text attribute
- label - text labels of a text or numeric attribute
- heatmap - a stylized representation of points
- Optionally:
- A filter defining the subset of things to draw
- Additional parameters based on the method of drawing
A moderately complex example would be:
from=us_census00.county_geom # what to draw mode=theme # method of drawing # 'theme' styling directives select=uselect_pres.county_data.prt_obama_votes # variable to to determine grouping breaks=0.3,0.35,0.4,0.45,0.5,0.55,0.6,0.65,0.7 # definition of groups colors=FF000080,FFFFFF80,0000FF80 # colors, interpolated between groups
These parameters are encoded into a tile request, which, quilted together by a mapping framework, looks like:
You'll find specifying layers in the Javascript API echoes the URL parameters:
// A familiar map of the portion vote by candidate in the 2008 US Presidential Election
var easy_map = new MF.EasyMap({
tileSpec: new MF.Render.TileSpec({
layers: [
new MF.Render.ThemeLayer({
select: 'uselect_pres.county_data.prt_obama_votes',
from: 'us_census00.county_geom',
colors: ['FF000080','FFFFFF80','0000FF80'],
breaks: Number.range(30,65,5).map(function (x) { return x/100 })
})
]
}),
// map type can be one of 'bing','google','ol','cloudmade'
maptype: 'bing',
lat: 37.5,
lng: -100,
zoom: 3,
nolegend: true
})
easy_map.getMapUrl()
What to draw
The Mapfluence data warehouse includes a constantly growing collection of data sources and spatial datasets (and if it is not there and you need it: let us know).
You'll find the available geometries in the Mapfluence Data Catalog. If you need help using the data catalog, read more about it here.
The Draw Method
Below is a table of illustrating drawing methods and an assortment of styles:
| method | Polygons | Lines | Points |
| simple | ![]() |
![]() |
![]() |
| class | ![]() |
![]() |
![]() |
| theme | ![]() |
![]() |
![]() |
| label | ![]() |
![]() |
![]() |
| heatmap | N/A | N/A | ![]() |
Next!
Check out the Mapfluence API Developer Lab for more examples; then dive into the syntax.












