Using the IlvVMAPReader class to create images

To read VMAP features using the IlvVMAPReader object:
  1. Create an IlvVMAPReader instance from the path of the VMAP database (the directory containing DHT and LAT files, parent of the libraries):
    String databasePath = "C:/VMAP/vmaplv0/";
    IlvVMAPReader VMAPReader = new IlvVMAPReader(databasePath);
    
  2. You must also specify the library to read. The libraries available in a database correspond to the sub-directories of the database directory. Here we assume that the database directory is vmaplv0 and that there is a subdirectory vmaplv0/eurnasia:
    VMAPReader.setLibraryName("eurnasia"); // this is Europe and Northern Asia 
    library
    
  3. Optionally, you can specify the region of interest (in degrees). Only features of this area are read:
    VMAPReader.setRegionOfInterest(0,30,15,45);
    
  4. You can also limit what is read to features specified by particular FACC codes (for further information about FACC codes, refer to the VMAP format specification). For instance, to read only roads, you can use:
    VMAPReader.setFaccFilter(new String[]{"AP030"});
    
  5. Finally, iterate over the features, render them with an appropriate IlvFeatureRenderer, and assign them to a manager:
    IlvMapFeature feature = VMAPReader.getNextFeature();
    IlvManager manager = view.getManager();
    
    // Create default renderer
    IlvFeatureRenderer renderer = new IlvDefaultFeatureRenderer();
    
    while(feature != null) {
    
      // Render map feature into graphic object
      IlvGraphic graphic = renderer.makeGraphic(feature,null);
    
      // Add this object on the first layer of the manager
      manager.addObject(graphic, 0, false);
    
      feature = VMAPReader.getNextFeature();
    }