Skip to content

Nml 3d models map layer

nutiteq edited this page Apr 7, 2013 · 9 revisions

Nutiteq SDK supports also 3D models on map.

NB! Model must be quite simple to fit to device memory. Best if they are 4 walls + roof with textures, especially if you want to have bigger regions like whole city. Most models you can find from http://sketchup.google.com/3dwarehouse/ are way too nice and complicated, have hundreds of thousands vertexes and you will see OutOfMemory exceptions.

Nutiteq SDK uses own internal format (NML) to keep 3D models, the data is highly pre-processed to optimise mobile rendering speed and reduce memory usage in general zoom levels. Nutiteq provides command-line converter tool for KMZ/Collada models which can be exported from Trimple Sketchup or downloaded from the 3D Warehouse. If you are interested, please contact [email protected] to have free test/sample conversions with your models. In principle you can also build 3D models with code, using com.nutiteq.nmlpackage classes, but usually converter approach is more practical.

Additional sample: Barcelona main sights: barca_3dwh_sample.nmldb.zip - uncompress before using. Data from Trimble 3D warehouse

So the steps are:

  1. Make sure that you have latest SDK and protobuf-java-2.4.1-lite.jar in your project libs folder
  2. Download Transamerica 3D Model and copy to your device /sdcard folder. source
  3. Add following after setBaseLayer() in HelloMap3DActivity.java:
        // define style for 3D to define minimum zoom = 0 
        ModelStyle modelStyle = ModelStyle.builder().build();
        StyleSet<ModelStyle> modelStyleSet = new StyleSet<ModelStyle>(modelStyle);
        
        // add real layer
        NMLModelDbLayer modelLayer = new NMLModelDbLayer(new EPSG3857(),
                "/sdcard/transamerica2.nml", modelStyleSet);
        
        mapView.getLayers().addLayer(modelLayer);
  1. Run the app, zoom in enough and you should see: Transamerica in 3D on Android
Clone this wiki locally