Mar
16
2009
1

Data structure design for vector map

Vector map’s basic objects:

Vector map usually consists of 2 types of objects: render objects and routing objects.

Render objects:

Countries

Cities/Provinces

Points

Polylines

Polygons

Here is the data structure model that you can use for your mobile map application:

Data structure for Country:

String name;

int x; (Longitude (32bit))

int y; (Latitude (32bit))

short numPoint; (16bit)

– follow by array of x and y different to define boundaries of this country

short dataX[]; (Array of Longitude Diff (16bit))

short dataY[]; (Array of Latitude Diff (16bit))

Data structure for City/Province:

String name;

short CountryID; (16bit)

int x; (Longitude (32bit))

int y; (Latitude (32bit))

short numPoint; (16bit)

– follow by array of x and y different to define boundaries of this city/province

short dataX[]; (Array of Longitude Diff (16bit))

short dataY[]; (Array of Latitude Diff (16bit))

Data structure for Point:

String name;

String address;

String phoneNumber;

String postalCode;

byte type: (8bit) for example 0 - bridge, 1 - petrol station, 2 - parking, 3 - bus station/ground transportation…

int CityID; (32bit)

int x; (Longitude (32bit))

int y; (Latitude (32bit))

Data structure for Polyline:

String name;

byte type; (8bit) for example 0 - river/stream, 1 - residential/small road, 2 - large road, 3 - highway, 4 - railway…

byte dirIndicator; (8bit) 0 - two ways road, 1 - one way road

int CityID; (32bit)

int x; (Longitude (32bit))

int y; (Latitude (32bit))

short numPoint; (16bit)

– follow by array of x and y different

short dataX[]; (Array of Longitude Diff (16bit))

short dataY[]; (Array of Latitude Diff (16bit))

short numNode; (16bit) number of routing nodes belong to this polyline, point at an intersection of 2 or more polylines will be routing node. one polyline may have a few intersections with other polylines. The first point and end point of one polyline are always routing node.

short pointID[]; (Array of Point ID (16bit)) index or offset from 0 to numPoint to indicator which point of polyline is routing node.

int nodeID[]; (Array of Node ID (32bit)) node ID point to routing node

Data structure for Polygon:

String name;

byte type; (8bit) 0 - water/lake, 1 - park/garden, 2 - other background polygon (building/adminstration areas…)

int CityID; (32bit)

int x; (Longitude (32bit))

int y; (Latitude (32bit))

short numPoint; (16bit)

– follow by array of x and y different

short dataX[]; (Array of Longitude Diff (16bit))

short dataY[]; (Array of Latitude Diff (16bit))

Routing objects:

Routing node

Routing graph

Data structure for routing node:

int x; (Longitude (32bit))

int y; (Latitude (32bit))

byte numLink; (8bit) number of other routing nodes can be linked from this routing node

byte linkType[]; (Array of Link Type (8bit)) use 8 bits to indicator whether this link can be used forcar=”1/0″, forbus=”1/0″, fortrain=”1/0″, fortruck=”1/0″, formotobicycle=”1/0″, forbicycle=”1/0″, forpedestrian=”1/0″, forwheelchair=”1/0″

int linkNodeID[]; (Array of Link Node ID (32bit)) store routing node IDs that this node link to

int linkCostDistance[]; (Array of Link Cost Distance in meter (32bit)) store distance need to travel from this node to link node, it will be used for calculate shortest route.

int linkCostTime[]; (Array of Link Cost Time in second (32bit)) store time need to travel by car from this node to link node, it will be used for calculate fastest route.

Data structure for routing graph:

Node graph[];

Application is using this Open Mobile Map Data Structure:

VGPS (www.digitalmobilemap.com)

OpenMobileMap would not be possible without the generous support from our sponsors:

www.andgps.com provides gps and routing source code templates for android developers

www.j2megps.com provides gps and routing source code templates for j2me developers


OpenMobileMap | The Free Mobile Map Resources