Skip to content
Nutiteq edited this page Nov 27, 2013 · 131 revisions

Getting started with Nutiteq Android 3D Maps SDK

Introduction

This wiki is the guide to get started with [Nutiteq] (http://www.nutiteq.com/) Android 3D mapping SDK.

SDK Downloads

Dependencies

  • javaproj-1.0.7-noawt.jar - mandatory
  • Specific Layers may require additional dependencies. You can get ones from AdvancedMap3D extlibs (Java) and libs (NDK) folders, or just use Maven Eclipse plug-in to manage the dependencies automatically.

Development snapshots

Maven repository

  • See pom.xml in AdvancedMap3D project how to use Nutiteq Maven repository. The sample requests "snapshot" version, but you can also include release versions (from 1.0.1), just change it in version tag. Repo has are also SDK javadocs, but no sources.
  • Nutiteq release repository has also 3rd party dependencies used by some AdvancedMap3D layers.

Prerequisities

  • Android SDK installed and running
  • Basic knowledge about Android app development
  • GIT client running and basic usage knowledge

Discussions and support

Try it out right away

Clone this project, compile it with Android SDK and run it on Android device (not emulator). It has basic map viewing and required 3rd party libraries included.

See this video to get an idea what to expect: http://youtu.be/WzqpEBjx6jg

You can get also one of following basic map apps from Google Play Store:

Getting started step by step

Preparations

  1. Clone the HelloMap3D project. You will need some files from it.
git clone [email protected]:nutiteq/hellomap3d.git
  1. Create new Android project. Set Android SDK level 8 as minimum
  2. Give minimum permissions in AndroidManifest.xml: android.permission.INTERNET to read maps online
  3. Copy some useful resource files and libraries from the demo project to your project. Take all files to same folders of your project: res/drawable/ and libs/

Create map

  1. Define your application main layout as res/layout/main.xml, so it has map element:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >
   <com.nutiteq.MapView
    android:id="@+id/mapView"
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    />
</LinearLayout>
  1. Create map object. Now we can define MapView type of member in your main activity class, load layout and load the MapView from layout. The object is created now.
public class HelloMap3DActivity extends Activity {

    private MapView mapView;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        mapView = (MapView) findViewById(R.id.mapView);
...
  1. Initialize and start map. Map object itself does not work right away. Three steps are needed here as minimum: (a) define map configuration package, which is put in Components object, (b) define base map layer and finally (c) tell map object to start map activities (downloading threads etc).
      // define new configuration holder object
      mapView.setComponents(new Components());

      // Define base layer. Here we use MapQuest open tiles which are free to use
      // Almost all online maps use EPSG3857 projection.
      TMSMapLayer mapLayer = new TMSMapLayer(new EPSG3857(), 0, 18, 0,
             "http://otile1.mqcdn.com/tiles/1.0.0/osm/", "/", ".png");
      mapView.getLayers().setBaseLayer(mapLayer);
 
      // start mapping
      mapView.startMapping();

After this, if you are lucky, you can start the application on your phone and it should show map. Congratulations!

Next steps

A lot of of more advanced samples and map data layers are in AdvancedMap3D application, which is also in the same GIT repository as simple HelloMap.

3D specific

Map Layers

  • Tile Sources - select base map, streets or satellites based on terms and needs
  • CustomMarkerLayer - sample custom layer with Marker objects. Data is loaded on-line, based on tiles (so it is cacheable in both server and client side).
  • WMS map layer - useful for GIS people. It requests WMS map by tiles, so you can have server-side caching in addition to client caching (which is done for tiles anyway).
  • Mapsforge layer - use Mapsforge open source library to generate maps from offline vector data.
  • GDAL layer - use GDAL library to read raster data from wide range of different data formats (e.g. GeoTIFF, BSB etc)
  • OGR layer - use OGR library to read vector data from variety of file formats like ESRI Shapefiles, S-57, SDTS, Mapinfo mid/mif and TAB
  • Spatialite layer - SQLite-based offline data storage
  • Combined tile sources - combination of offline (packaged) map and online tiles
  • Offline map tiles - how to use offline maps with MBTiles, and other built-in source options
  • MapBox layer uses MapBox tiles with UTFGrid tooltips and legend
  • CartoDB layer uses CartoDB server API
  • Short overview of AdvancedLayers

Routing

Geocoding

Labels

Editing

General notes

  • All resource images should be prepared as square with size of power of 2 to be compatible with maximum number of devices: 8x8, 16x16,32x32 etc. Some functions do fix (resize) the image automatically, but not all (yet).
  • Testing with emulator. To run the app you need latest (4.x) emulator ABI, and make sure that "GPU Emulation" feature is turned on (it is off by default). Note that Android Emulator still does not support multi-touch gestures, so we suggest to use real device for testing.
  • To turn on SDK logging add these lines to beginning of your onCreate():
        Log.enableAll();
        Log.setTag("mymapapp");

License

All the code in this project is free under MIT license.

There are following license options for Nutiteq SDK core:

  • Development and commercial evaluation usage - free. Just download and use.
  • Usage for OpenStreetMap applications - free according to Free-openstreetmap-license
  • Commercial license. Request [email protected] for details.

Following third party open source software is used / required:

a) in the core SDK library:

b) in HelloMap3D/AdvancedMap layers:

  • Sourceforge (MIT license) - in Sourceforge layer
  • GDAL/OGR (free non-viral license) - in GDAL and OGR layers
  • JTS (LGPL) - in OSM 3D Online layer
  • Graphhopper - in Offline routing sample
  • JMustache - in MapBox and MBTiles samples
  • GSON - in WFSLayer
Clone this wiki locally