1

I have to do a mobile application which will have my own paths that i have to put in the map, what is the best way to manage the paths? KML files with the paths and upload them to the map or a specific database for that purpose?

hmjc
  • 13
  • 4
  • This is likely to be closed as too broad. "What is the best way to..." is not a popular type of question. Recommend rewording to try make it more specific. – Richard Le Mesurier Nov 01 '15 at 14:16
  • paths?? just out of interest, what do you mean by that. Draw on the Map? – Tasos Nov 01 '15 at 14:24
  • 1
    You could just store the source and destination points in SQLite, and use the directions API to draw the paths, see here for example: http://stackoverflow.com/a/32940175 – Daniel Nugent Nov 01 '15 at 16:24

1 Answers1

1

Well, I'm using a simple SQLite database for that and it works fine, first I save the locations as real types in the database and then I can save the locations on a list of LatLgn objects or on a hashmap with String key and Marker object, for example:

private void getLatLgns() {

    DBConnection dbc = new DBConnection(this, "MapsDB", null, 1); 
    SQLiteDatabase db = dbc.getWritableDatabase();

    Cursor c = db.rawQuery("SELECT Latitude,Longitude from Records", null);
    if(c.moveToFirst()){ 
        do {
            allLatLng.add(new LatLng(Double.parseDouble(c.getString(0)), Double.parseDouble(c.getString(1))));
        }while (c.moveToNext());
    }
    db.close();
}    

private void addingMarkers {

for (int x= 0; x < allLatLng.size() ; x++) {
        hashMarkers.put(String.valueOf(x), mMap.addMarker(new MarkerOptions()
                .position(allLatLng.get(x)));
        Log.d("Position:", x + " " + allLatLng.get(x).latitude + " " + allLatLng.get(x).longitude);
    }

}

Brandon Zamudio
  • 2,853
  • 4
  • 18
  • 34