-
Notifications
You must be signed in to change notification settings - Fork 75
Home
This wiki is the guide to get started with [Nutiteq] (http://www.nutiteq.com/) Android 3D mapping SDK.
- nutiteq-3d-sdk-2.3.0.jar - SDK
- nutiteq-3d-sdk-2.3.0-javadoc.jar - API Javadoc
- Browse javadoc
- 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.
- nutiteq-3d-sdk-snapshot.jar - latest development snapshot. javadoc
- AdvancedMap3D sample app, pre-built - AdvancedMap3D-23rc.apk
- 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.
- Android SDK installed and running
- Basic knowledge about Android app development
- GIT client running and basic usage knowledge
- Community support and discussions: email to [email protected] or use web forum
- Professional developer support: contact [email protected]
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
- AdvancedMap3DStart - how to run it with or without Maven, some troubleshooting tips
You can get also one of following basic map apps from Google Play Store:
- Offline Maps 3D - shows offline maps for various countries
- Offline map for Barcelona MWC - shows offline maps, 3D model layer and 3D screen support features
- Clone the HelloMap3D project. You will need some files from it.
git clone [email protected]:nutiteq/hellomap3d.git
- Create new Android project. Set Android SDK level 8 as minimum
- Give minimum permissions in AndroidManifest.xml: android.permission.INTERNET to read maps online
- 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/
- 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>
- 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);
...
- 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!
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.
- BasicMarker - Add a clickable marker to map
- BasicEvents - Get clicks on objects, map movement and drawings
- GPSAnimation - Show animated GPS location, size depends on accuracy
- BasicConfiguration - caching and other options for smoother UX
- HandleFlip, so map view is not reset
- Setting Constraints to map manipulation (zoom, area, tilt, rotation)
- Different device resolutions - how to handle huge variation of DPI on Android
- VectorObjects - Add lines, polygons and points to map
- Animated marker - animate markers, or any other objects on map
- Map calculations - screen to geo, geo to screen etc
- Take look to JavaDoc package found in root of sample application project. Check out MapView methods first of all, then Options and different Geometries which require Style definitions.
- Upgrading from Nutiteq MGMaps SDK 1.x
- Polygon3D is simplest object to get started with 3D world
- Globe renderer
- NMLModelDbLayer enables to include KMZ/Collada models to map
- OpenStreetMap buildings in 3D
- Stereo display mode for HTC and LG Real3D screens
- Single manipulatable 3D model on map load and show a small car
- 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
- Online routing using MapQuest Open API or CloudMade Routing API backends
- Offline routing using Graphhopper open source library
- Drive time regions layer using Graphhopper service
- Custom Label - how to customise label balloons
- Use View for Label - how to add view to map which looks like a balloon label.
-
Editable MapView - how to create editable layers for vector editing. See this first.
- Editable CartoDB Layer - specifics for CartoDB online editing
- Editable Spatialite Layer - specifics for Spatialite offline editing
- 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");
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:
- JavaProj - Apache License 2.0 http://sourceforge.net/projects/jproj4/
- SLF4J logging framework - MIT-style license http://www.slf4j.org/license.html
- Poly2tri - New BSD License http://code.google.com/p/poly2tri/
- Google Protobuf - in 3D model layers only
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