Android Question serialised data and objects

jamesnz

Active Member
Licensed User
Longtime User
I have a mapquest route return made up of usually 10-20 instructions. At the moment I'm making an array of maps to store the data, I also use the lat long data from each point in the route to make another 10-20 http requests from another 2 web services which give me 1/traffic light locations and 2/linestrings for the roads at the intersections.
So after all the requests I end up with
- a map for each point in the route key = index , value = (lat,lng,instruction)
-another map for each point in the route trafficlights key= index, value = (boolean)
-another map for each point in the route streets
key =index (streetname,(lat,lng)(lat,lng),(streetname,(lat,lng)(lat,lng), streetname,(lat,lng)(lat,lng)) ( 3 streets for this 1 point)

My app will be iterating through the maps when within 200m or so of each point and I'll need to do some comparisons at run time such as working out if the road ends at the intersection, or how many roads start or end at the intersection, and if a traffic light is present at the intersection.

I'd like to use objects rather than 3 maps, because I'm supposed to be learning how to ) :), but the question is : what is the best practice for storing multiple nested items of serialised data,
eg should I be making an array of objects for each point in the route and pull out the data from the lists , OR , should I have multiple objects storing data that is less serialised.
all advice appreciated, sample returns, stored in maps, below


B4X:
ROUTE_REQUEST
http://open.mapquestapi.com/directions/v2/route?key=Fmjtd%7Cluub2l0a2d%2C80%3Do5-96y0ly&callback=renderAdvancedNarrative&outformat=xml&routeType=shortest&timeType=1&enhancedNarrative=true&shapeFormat=raw&generalise=200&locale=en_GB&unit=K&from=-37.7734632,175.2754062&to=-37.7649604,175.3031446&drivingstyle=2&highwayEfficiency=30.0&doReverseGeocode=false



myroute : (MyMap)

{routeno0=[0, -37.773143, 175.275604, Set off going southeast on Riverview Terrace towards Tamihana Avenue.],

routeno1=[1, -37.773902, 175.276809, Take the 1st left onto Tamihana Avenue.],

routeno2=[2, -37.773033, 175.277801, Turn right onto Casey Avenue.],

routeno3=[3, -37.775917, 175.279388, Turn left onto Boundary Road. Pass over 1 roundabout.],

routeno4=[4, -37.772705, 175.293319, Enter next roundabout and take the 2nd exit onto Fifth Avenue.],

routeno5=[5, -37.768741, 175.301559, Enter next roundabout and take the 1st exit onto Wairere Drive.],

routeno6=[6, -37.766204, 175.300689, Turn right onto Powells Road.],

routeno7=[7, -37.765331, 175.303695, Turn left onto Alderson Road.],

routeno8=[8, -37.76482, 175.303466, You have arrived at your destination.]}





mystreets(MyMap)

{0=[[0, RIVERVIEW TERRACE, -37.772743838968985, 175.27286404159346, -37.77398830151145, 175.27678722644836]],

4=[[4, BOUNDARY ROAD, -37.77750604433196, 175.2743944568284, -37.77557020631344, 175.2927854279984], [4, FIFTH AVENUE, -37.772612587402904, 175.29348776054894, -37.76896772046124, 175.3008160318366], [4, PEACHGROVE ROAD, -37.78999489680443, 175.29972572847527, -37.76223834608222, 175.28812611941197]],

1=[[1, RIVERVIEW TERRACE, -37.772743838968985, 175.27286404159346, -37.77398830151145, 175.27678722644836], [1, TAMIHANA AVENUE, -37.773026752249365, 175.27778356416152, -37.775423643662805, 175.27707934380925]],

3=[[3, BOUNDARY ROAD, -37.77750604433196, 175.2743944568284, -37.77557020631344, 175.2927854279984], [3, CASEY AVENUE, -37.7713328197432, 175.2752504760555, -37.775913390798614, 175.2793438930217]],

2=[[2, CASEY AVENUE, -37.7713328197432, 175.2752504760555, -37.775913390798614, 175.2793438930217], [2, TAMIHANA AVENUE, -37.773026752249365, 175.27778356416152, -37.775423643662805, 175.27707934380925]],

6=[[6, POWELLS ROAD, -37.76297723446931, 175.31193456687012, -37.76649600889577, 175.2997330671382]],

5=Null,

8=[[8, ALDERSON ROAD, -37.76299854112838, 175.2981701975947, -37.765347037836825, 175.30366717295436]],

7=[[7, POWELLS ROAD, -37.76297723446931, 175.31193456687012, -37.76649600889577, 175.2997330671382], [7, ALDERSON ROAD, -37.76299854112838, 175.2981701975947, -37.765347037836825, 175.30366717295436]]}


mylights

mylights(MyMap) {
lights0=false,
lights1=false,
lights2=false,
lights3=false,
lights4=false,
lights5=false,
lights6=false,
lights7=false,
lights8=false}
 
Top