VANET Simulator
 All Classes Functions Variables
Public Member Functions | Static Public Member Functions | List of all members
vanetsim.map.OSM.OSMLoader Class Reference

Public Member Functions

void loadOSM (File file)
 
boolean WGS84toUTM (double[] result, double longitude, double latitude, boolean calculateZone, double longitudeMiddle, boolean highPrecision)
 

Static Public Member Functions

static OSMLoader getInstance ()
 

Detailed Description

A class including functionality to import streets from the OpenStreetMap project. Implemented as Singleton.

Member Function Documentation

static OSMLoader vanetsim.map.OSM.OSMLoader.getInstance ( )
inlinestatic

Gets the single instance of OSM_Loader.

Returns
single instance of OSM_Loader
void vanetsim.map.OSM.OSMLoader.loadOSM ( File  file)
inline

Function to load in an OSM map in OSM Protocol version 0.5. See the protocol specifications the other wiki entries and the source annotations for details. This functions expects an already downloaded file from a bounding box link like http://api.openstreetmap.org/api/0.5/map?bbox=11.54,48.14,11.543,48.145 or created by Osmosis as an input.
The parsing code assumes that all nodes are declared before the first way comes (which is so in all currently known OSM files).

Notes:

  • If the map is somewhere in the pacific ocean and there are negative AND positive values for the latitude, this function does not work as minLatitude and maxLatitude aren't set correctly. However, there should not be any really interesting maps there...
  • If there are nodes which don't belong to a street (but rather to some sightseeing place or so) the map might get too large as the map size must be calculated before the type of the node can be checked.
Parameters
filethe file to import
boolean vanetsim.map.OSM.OSMLoader.WGS84toUTM ( double[]  result,
double  longitude,
double  latitude,
boolean  calculateZone,
double  longitudeMiddle,
boolean  highPrecision 
)
inline

Convert a WGS84 coordinate to the Universal Transverse Mercator coordinate system.

Parameters
resultan array which can be used to store the results. The array must consist of at least two elements. The x coordinate will be stored in result[0], the y coordinate in result[1] (both have meters as scale)
latitudethe latitude in the WGS84 system
longitudethe longitude in the WGS84 system
calculateZonetrue if the zone should be calculated, false if you want to set your own longitudeOrigin
longitudeMiddleused to set your own longitude as the middle of the UTM zone (only used if calculateZone=false!). Note that using this gives results which are not conforming to UTM anymore.
If you have multiple locations in normally different UTM zones you can use this to get correct distances between all locations. The value for this variable should be the same for all your locations and it should also be near your other locations (ideally the one in the middle of all).
highPrecisionIf some higher order terms for calculation should be used. Setting to true needs more performance but gives more precision in the sub-millimeter-range.
Normally setting to false should be fine!
Returns
true if calculation succeeded, else false (error in your input!)

The documentation for this class was generated from the following file: