Welcome to the fourth blog post of our mobile blog series! We hope you have been learning new insights on how to leverage CartoDB’s native mobile SDK for your device. Today, we’ll be discussing the most typical application of the SDK: showing data on a map and how it can be done technically.
Data when added to the map is organized in layers, a concept that should be familiar to GIS users. The usual approach is to add one TileLayer to a basemap, as suggested in our Getting Started Guide (e.g. our tiled vector map with OpenStreetMap data). Then, you add one or several interactive VectorLayers on top of that, filled with markers, texts, and pop-ups.
Technically, our map SDK has one powerful concept: each map layer must have a ‘DataSource.’ This defines the where and how the layer retrieves data. In this case we use ‘LocalVectorDataSource,’ which keeps map objects (vector data in other words) in memory, and is used for VectorLayers to create map data overlays. Note: you need to use VectorLayer and LocalVectorDataSource even for just one marker on your map.
With the Nutiteq SDK, you can add various different objects: markers, points, lines, polygons, text, balloon pop-ups, and 3D models on the map. For each object the app must define styling (colors, icon, width, size), specify coordinates, and then add it to LocalVectorDataSource. Then we create a VectorLayer with the data source and add the layer to the map.
See following table for different object type details:
Now it is time to code! For the app code samples see adding objects to the map page in our documentation portal.
Happy mobile data mapping!
The Data Observatory keeps on growing! After our initial release, which included the American Community Survey in the United States and the Spanish Census, and later demogr...
ProductWe are proud to announce the availability of demographic data for England and Wales from the Office for National Statistics in the United Kingdom.
NewsIf you follow us on Twitter at all you have probably seen our announcement of the Data Observatory. We are excited about the release and also excited about what it brings t...
ProductPlease fill out the below form and we'll be in touch real soon.