@Override
    protected void onPostExecute(Void result) {
      Polyline route =
          oMapView.addPolyline(new PolylineOptions().width(5).color(Color.BLUE).geodesic(true));
      route.setPoints(aLatLng);

      oMapView.addMarker(
          new MarkerOptions()
              .position(ExerciseManipulate.getWatchPoint().get(0).getLatLong())
              .title("Start"));
      oMapView.addMarker(
          new MarkerOptions()
              .position(
                  ExerciseManipulate.getWatchPoint()
                      .get(ExerciseManipulate.getWatchPoint().size() - 1)
                      .getLatLong())
              .title("End " + ExerciseManipulate.getsTotalDistance()));

      CameraPosition newCamPos =
          new CameraPosition(
              ExerciseManipulate.getWatchPoint()
                  .get(ExerciseManipulate.getWatchPoint().size() / 2)
                  .getLatLong(),
              12.5f,
              oMapView.getCameraPosition().tilt, // use old tilt
              oMapView.getCameraPosition().bearing); // use old bearing
      oMapView.animateCamera(CameraUpdateFactory.newCameraPosition(newCamPos), 4000, null);

      // oMapView.addPolyline((new PolylineOptions()).addAll(aLatLng));
      // oMapView.moveCamera(CameraUpdateFactory.newLatLng(ExerciseManipulate.getWatchPoint().get(0).getLatLong()));
    }
  public void removeAirplaneTrack() {
    if (currentAirplaneSelected != null)
      synchronized (currentPolyTrack) {
        updaterService.doRemoveRouteFrom(currentAirplaneSelected);

        for (Polyline line : currentPolyTrack.values()) {
          Log.i("DEBUG", "Removendo Linha");
          line.remove();
        }

        currentPolyTrack.clear();
        currentAirplaneSelected = null;
      }
  }
  /**
   * Create polyline
   *
   * @param args
   * @param callbackContext
   * @throws JSONException
   */
  @SuppressWarnings("unused")
  private void createPolyline(final JSONArray args, final CallbackContext callbackContext)
      throws JSONException {
    final PolylineOptions polylineOptions = new PolylineOptions();
    int color;
    LatLngBounds.Builder builder = new LatLngBounds.Builder();

    JSONObject opts = args.getJSONObject(1);
    if (opts.has("points")) {
      JSONArray points = opts.getJSONArray("points");
      List<LatLng> path = PluginUtil.JSONArray2LatLngList(points);
      int i = 0;
      for (i = 0; i < path.size(); i++) {
        polylineOptions.add(path.get(i));
        builder.include(path.get(i));
      }
    }
    if (opts.has("color")) {
      color = PluginUtil.parsePluginColor(opts.getJSONArray("color"));
      polylineOptions.color(color);
    }
    if (opts.has("width")) {
      polylineOptions.width(opts.getInt("width") * this.density);
    }
    if (opts.has("visible")) {
      polylineOptions.visible(opts.getBoolean("visible"));
    }
    if (opts.has("geodesic")) {
      polylineOptions.geodesic(opts.getBoolean("geodesic"));
    }
    if (opts.has("zIndex")) {
      polylineOptions.zIndex(opts.getInt("zIndex"));
    }

    Polyline polyline = map.addPolyline(polylineOptions);
    String id = "polyline_" + polyline.getId();
    this.objects.put(id, polyline);

    String boundsId = "polyline_bounds_" + polyline.getId();
    this.objects.put(boundsId, builder.build());

    JSONObject result = new JSONObject();
    result.put("hashCode", polyline.hashCode());
    result.put("id", id);
    callbackContext.success(result);
  }
  /**
   * Remove the polyline
   *
   * @param args
   * @param callbackContext
   * @throws JSONException
   */
  @SuppressWarnings("unused")
  private void remove(final JSONArray args, final CallbackContext callbackContext)
      throws JSONException {
    String id = args.getString(1);
    Polyline polyline = this.getPolyline(id);
    if (polyline == null) {
      this.sendNoResult(callbackContext);
      return;
    }
    this.objects.remove(id);

    id = "polyline_bounds_" + polyline.getId();
    this.objects.remove(id);

    polyline.remove();
    this.sendNoResult(callbackContext);
  }
  /**
   * Set points
   *
   * @param args
   * @param callbackContext
   * @throws JSONException
   */
  @SuppressWarnings("unused")
  private void setPoints(final JSONArray args, final CallbackContext callbackContext)
      throws JSONException {
    String id = args.getString(1);
    Polyline polyline = this.getPolyline(id);

    JSONArray points = args.getJSONArray(2);
    List<LatLng> path = PluginUtil.JSONArray2LatLngList(points);
    polyline.setPoints(path);

    LatLngBounds.Builder builder = new LatLngBounds.Builder();
    for (int i = 0; i < path.size(); i++) {
      builder.include(path.get(i));
    }
    this.objects.put("polyline_bounds_" + polyline.getId(), builder.build());

    this.sendNoResult(callbackContext);
  }
 private void update_polyline() {
   ArrayList<LatLng> tempLat = new ArrayList<LatLng>();
   for (int i = 0; i < markerArray.size(); i++) {
     LatLng latLng = markerArray.get(i).getPosition();
     tempLat.add(latLng);
   }
   latLngsArray = tempLat;
   polyline.setPoints(tempLat);
 }
Exemplo n.º 7
0
  // Executes in UI thread, after the parsing process
  @Override
  protected void onPostExecute(List<List<HashMap<String, String>>> result) {

    ArrayList points = null;
    PolylineOptions lineOptions = null;
    MarkerOptions markerOptions = new MarkerOptions();
    if (!polylines.isEmpty()) {
      for (Polyline p : polylines) p.remove();
    }

    // Traversing through all the routes
    for (int i = 0; i < result.size(); i++) {
      points = new ArrayList();
      lineOptions = new PolylineOptions();

      // Fetching i-th route
      List<HashMap<String, String>> path = result.get(i);

      // Fetching all the points in i-th route
      for (int j = 0; j < path.size(); j++) {
        HashMap<String, String> point = path.get(j);

        if (j == 0) { // Get duration from the list

          // if(map.DurFlag==true){
          //  Log.d("durationparse:", (String)point.get("duration")+ "");
          //  Algorithm.duration += (String)point.get("duration");
          durat = (String) point.get("duration");
          Log.d("point :", path.get(1) + "" + path.get(path.size() - 1));
          heu = Double.parseDouble(durat.substring(0, durat.indexOf(" ")));
          Log.d("heu", heu + "");
          // Algorithm.Astar(testroute.fromId, testroute.toId,
          // Double.parseDouble(testroute.fromCoorX), Double.parseDouble(testroute.fromCoorY),
          // Double.parseDouble(testroute.toCoorX), Double.parseDouble(testroute.toCoorY));
          map.DurFlag = true;
          // delegate.processFinish(durat);

          return; //
          // }

          // continue;
        }
        double lat = Double.parseDouble(point.get("lat"));
        double lng = Double.parseDouble(point.get("lng"));
        LatLng position = new LatLng(lat, lng);

        points.add(position);
      }

      /*  if(map.DurFlag==false) {
      // Adding all the points in the route to LineOptions
                      lineOptions.addAll(points);
                      lineOptions.width(8);
                      lineOptions.color(Color.RED);
                  }*/
      lineOptions.addAll(points);
      lineOptions.width(8);
      lineOptions.color(Color.RED);
    }

    if (map.DurFlag == false && lineOptions != null) {
      // Drawing polyline in the Google Map for the i-th route
      polylines.add(map.map.addPolyline(lineOptions));
    }
  }
 private void updatePolyline() {
   mPolyline.setPoints(Arrays.asList(mMarkerA.getPosition(), mMarkerB.getPosition()));
 }
Exemplo n.º 9
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    setContentView(R.layout.activity_map);

    SharedPreferences prefs =
        getApplicationContext().getSharedPreferences(TaskListActivity.PREFS_NAME, 0);
    boolean isShowAll = prefs.getBoolean("mapShowAll", false);

    chbShowAll = (CheckBox) findViewById(R.id.chbShowAll);
    chbShowAll.setChecked(isShowAll);
    chbShowAll.setOnCheckedChangeListener(
        new OnCheckedChangeListener() {

          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            SharedPreferences.Editor editor = TaskListActivity.settings.edit();
            editor.putBoolean("mapShowAll", isChecked).commit();
            sbRadOuter.setEnabled(!isChecked);
            outerCircle.setVisible(!isChecked);
            showAll(isChecked);
          }
        });

    tvDist = (TextView) findViewById(R.id.tvDist);
    sbRadOuter = (SeekBar) findViewById(R.id.sbRad);
    sbRadOuter.setOnSeekBarChangeListener(new mapSeeksListener());
    sbRadOuter.setProgress(1);
    sbRadOuter.setEnabled(!isShowAll);

    ProgressDialog loadProgress =
        ProgressDialog.show(this, "Finding your location", "Please wait...", true);
    map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
    map.setInfoWindowAdapter(new myTaskInfoAdapter());
    map.getUiSettings().setZoomControlsEnabled(false);
    locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);

    locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, this);

    Location loc = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
    if (loc == null) {
      progressDialog = ProgressDialog.show(this, "Finding your location", "Please wait...", true);
    } else {
      updateMarker(loc);
    }
    setMarkersOptions(loc);

    loadProgress.dismiss();

    outerCircle = drawCircle(myLatLng, ((double) sbRadOuter.getProgress()) / 10d, Color.BLUE, 5);
    outerCircle.setVisible(!isShowAll);

    map.setOnCameraChangeListener(
        new OnCameraChangeListener() {

          @Override
          public void onCameraChange(CameraPosition camera) {
            if (camera.zoom >= 15.0) {
              sbRadOuter.setMax(10);
            } else if (camera.zoom < 15.0 && camera.zoom >= 14.0) {
              sbRadOuter.setMax(20);
            } else if (camera.zoom < 14.0 && camera.zoom >= 13.5) {
              sbRadOuter.setMax(30);
            } else if (camera.zoom < 13.5 && camera.zoom >= 12.5) {
              sbRadOuter.setMax(50);
            } else if (camera.zoom < 12.5 && camera.zoom >= 12.0) {
              sbRadOuter.setMax(100);
            } else if (camera.zoom < 12.0 && camera.zoom >= 11.0) {
              sbRadOuter.setMax(200);
            } else if (camera.zoom < 11.0 && camera.zoom >= 10.0) {
              sbRadOuter.setMax(400);
            } else if (camera.zoom < 10.0 && camera.zoom >= 9.0) {
              sbRadOuter.setMax(800);
            } else if (camera.zoom < 9.0 && camera.zoom >= 8.0) {
              sbRadOuter.setMax(1600);
            } else if (camera.zoom < 8.0 && camera.zoom >= 7.0) {
              sbRadOuter.setMax(3200);
            } else if (camera.zoom < 7.0 && camera.zoom >= 6.0) {
              sbRadOuter.setMax(6400);
            } else if (camera.zoom < 6.0 && camera.zoom >= 5.0) {
              sbRadOuter.setMax(12800);
            } else if (camera.zoom < 5.0 && camera.zoom >= 4.0) {
              sbRadOuter.setMax(25600);
            } else if (camera.zoom < 4.0 && camera.zoom >= 3.0) {
              sbRadOuter.setMax(51200);
            }
          }
        });
  }
Exemplo n.º 10
0
  private void updateMap() {
    if (map == null) {
      return;
    }
    Station station = Db.get().getStop(adapter.getStops().get(0).id);
    LatLng ll =
        new LatLng(Double.parseDouble(station.getLat()), Double.parseDouble(station.getLng()));
    PolylineOptions poly = new PolylineOptions();
    LatLngBounds llb = new LatLngBounds(ll, ll);
    // map.setMapType(GoogleMap.MAP_TYPE_NONE);
    int dimen = (int) getResources().getDimension(R.dimen.fab_size_mini) / 3;
    Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    int color = Color.RED;
    Bitmap bitmap = Bitmap.createBitmap(dimen, dimen, Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);
    paint.setStyle(Paint.Style.FILL_AND_STROKE);
    Station stationA = null, stationB = null;
    Calendar now = Calendar.getInstance();

    TripInfo.Stop previous = null;
    float percent = 0;
    for (TripInfo.Stop stop : adapter.getStops()) {

      canvas.clipRect(0, 0, canvas.getWidth(), canvas.getHeight());
      station = Db.get().getStop(stop.id);
      Log.d(
          TAG,
          station.getName()
              + " "
              + station.getLat()
              + ","
              + station.getLng()
              + " "
              + stop.depart.getTime());
      paint.setColor(color);

      if (now.after(stop.depart)) {
        stationA = station;
        previous = stop;
      } else {
        if (stationB == null && stationA != station) {
          stationB = station;
          if (previous == null) {
            percent = 0;
          } else if (previous.depart == null || stop.arrive == null) {

          } else {
            long max = stop.arrive.getTimeInMillis() - previous.depart.getTimeInMillis();
            long curr = stop.arrive.getTimeInMillis() - System.currentTimeMillis();

            if (curr <= 0) {
              percent = 0;
            } else {
              percent = 1 - (curr / (float) max);
            }
          }
        }
      }
      canvas.drawCircle(
          bitmap.getWidth() / 2, bitmap.getHeight() / 2, bitmap.getWidth() / 2, paint);
      station = Db.get().getStop(stop.id);
      LatLng latLng =
          new LatLng(Double.parseDouble(station.getLat()), Double.parseDouble(station.getLng()));
      llb = llb.including(latLng);

      if (markers.get(stop) != null) {
        markers.get(stop).remove();
      }
      Marker hamburg =
          map.addMarker(
              new MarkerOptions()
                  .position(latLng)
                  .anchor(0.5f, 0.5f)
                  .icon(BitmapDescriptorFactory.fromBitmap(bitmap)));
      markers.put(stop, hamburg);
      poly.add(latLng);
    }

    if (polyline != null) {
      polyline.remove();
    } else {
      map.moveCamera(CameraUpdateFactory.newLatLngBounds(llb, dimen));
    }
    // poly.
    polyline = map.addPolyline(poly);

    if (stationA == null) {
      return;
    }
    if (stationB == null) {
      stationB = stationA;
    }

    Location location = new Location(LocationManager.GPS_PROVIDER);
    location.setLatitude(Double.parseDouble(stationA.getLat()));
    location.setLongitude(Double.parseDouble(stationA.getLng()));

    Location location2 = new Location(LocationManager.GPS_PROVIDER);
    location2.setLatitude(Double.parseDouble(stationB.getLat()));
    location2.setLongitude(Double.parseDouble(stationB.getLng()));
    //        var θ = Number(brng).toRadians();
    //        var δ = Number(dist) / this.radius; // angular distance in radians
    //
    //        var φ1 = this.lat.toRadians();
    //        var λ1 = this.lon.toRadians();
    //
    //        var φ2 = Math.asin( Math.sin(φ1)*Math.cos(δ) +
    //                Math.cos(φ1)*Math.sin(δ)*Math.cos(θ) );
    //        var λ2 = λ1 + Math.atan2(Math.sin(θ)*Math.sin(δ)*Math.cos(φ1),
    //                Math.cos(δ)-Math.sin(φ1)*Math.sin(φ2));
    //        λ2 = (λ2+3*Math.PI) % (2*Math.PI) - Math.PI; // normalise to -180..+180°

    double totalDist = location.distanceTo(location2);

    Log.d(TAG, "distance is " + totalDist + " percentage is " + percent);

    double dist = (percent * totalDist) / (6371.0 * 1000.0);

    double brng = Math.toRadians(location.bearingTo(location2));
    double lat1 = Math.toRadians(location.getLatitude());
    double lon1 = Math.toRadians(location.getLongitude());

    double lat2 =
        Math.asin(
            Math.sin(lat1) * Math.cos(dist) + Math.cos(lat1) * Math.sin(dist) * Math.cos(brng));
    double a =
        Math.atan2(
            Math.sin(brng) * Math.sin(dist) * Math.cos(lat1),
            Math.cos(dist) - Math.sin(lat1) * Math.sin(lat2));
    System.out.println("a = " + a);
    double lon2 = lon1 + a;

    lon2 = (lon2 + 3 * Math.PI) % (2 * Math.PI) - Math.PI;

    System.out.println(
        "Latitude = " + Math.toDegrees(lat2) + "\nLongitude = " + Math.toDegrees(lon2));
    MarkerOptions o =
        new MarkerOptions()
            .anchor(0.5f, 0.5f)
            .icon(BitmapDescriptorFactory.fromResource(R.drawable.new_blue_dot))
            .position(new LatLng(Math.toDegrees(lat2), Math.toDegrees(lon2)));
    if (me != null) {
      me.remove();
    }
    if (stationA != stationB) {
      me = map.addMarker(o);
    }
    Log.d(TAG, "new coordinates are " + lat2 + "," + lon2);
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_map);

    user_name = getSharedPreferences("my_uid", Context.MODE_PRIVATE);
    uname = user_name.getString(USERNAME, "NULL");

    for (int i = 0; i < BusArray.length; i++) BusArray[i] = null;

    Intent intent = getIntent();
    String bus_no = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);
    Log.d("busNo", bus_no);

    myMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();

    myMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(29.6324, -82.3617), 13.0f));
    myMap.setMyLocationEnabled(true);

    PolylineOptions rectOptions =
        new PolylineOptions()
            .add(new LatLng(29.62532028, -82.37863156))
            .add(new LatLng(29.62506939, -82.37811707))
            .add(new LatLng(29.62476339, -82.37767182))
            .add(new LatLng(29.62425905, -82.37716645))
            .add(new LatLng(29.62356798, -82.37633432))
            .add(new LatLng(29.62273809, -82.37705615))
            .add(new LatLng(29.62211511, -82.37780999))
            .add(new LatLng(29.62055, -82.38021))
            .add(new LatLng(29.61989, -82.3797))
            .add(new LatLng(29.61784, -82.378))
            .add(new LatLng(29.61761, -82.3777))
            .add(new LatLng(29.61747, -82.37731))
            .add(new LatLng(29.61738, -82.37705))
            .add(new LatLng(29.61732905, -82.37667739))
            .add(new LatLng(29.6173146, -82.37653102))
            .add(new LatLng(29.61743, -82.37526))
            .add(new LatLng(29.61779, -82.37418))
            .add(new LatLng(29.61803, -82.37238))
            .add(new LatLng(29.62176, -82.3727))
            .add(new LatLng(29.62403, -82.3724))
            .add(new LatLng(29.62472, -82.3723))
            .add(new LatLng(29.62684, -82.3724))
            .add(new LatLng(29.62722, -82.3719))
            .add(new LatLng(29.62764, -82.37125))
            .add(new LatLng(29.62798, -82.37066))
            .add(new LatLng(29.62843, -82.36981))
            .add(new LatLng(29.62884, -82.36890))
            .add(new LatLng(29.62914, -82.36817))
            .add(new LatLng(29.62928, -82.36785))
            .add(new LatLng(29.63058, -82.36507))
            .add(new LatLng(29.63147, -82.36318))
            .add(new LatLng(29.63222, -82.36158))
            .add(new LatLng(29.63358, -82.35869))
            .add(new LatLng(29.63379, -82.35820))
            .add(new LatLng(29.63494, -82.35504))
            .add(new LatLng(29.63490, -82.35491))
            .add(new LatLng(29.63502, -82.35445))
            .add(new LatLng(29.63507, -82.35407))
            .add(new LatLng(29.63510, -82.35341))
            .add(new LatLng(29.63489, -82.35130))
            .add(new LatLng(29.63502, -82.35130))
            .add(new LatLng(29.63544, -82.35133))
            .add(new LatLng(29.63580, -82.35022))
            .add(new LatLng(29.63586, -82.35012))
            .add(new LatLng(29.63597, -82.35009))
            .add(new LatLng(29.63671, -82.35018))
            .add(new LatLng(29.63689, -82.35020))
            .add(new LatLng(29.63862, -82.35046))
            .add(new LatLng(29.63916, -82.35046))
            .add(new LatLng(29.64487, -82.35040))
            .add(new LatLng(29.64487, -82.34927))
            .add(new LatLng(29.64484, -82.34914))
            .add(new LatLng(29.64484, -82.34859))
            .add(new LatLng(29.64482, -82.34818))
            .add(new LatLng(29.64480, -82.34691))
            .add(new LatLng(29.64482, -82.34665))
            .add(new LatLng(29.64484, -82.34655))
            .add(new LatLng(29.64483, -82.34552))
            .add(new LatLng(29.64484, -82.34434))
            .add(new LatLng(29.64484, -82.34351))
            .add(new LatLng(29.64654, -82.34351))
            .add(new LatLng(29.64653, -82.34360))
            .add(new LatLng(29.64579, -82.34525))
            .add(new LatLng(29.64573, -82.34546))
            .add(new LatLng(29.64571, -82.34566))
            .add(new LatLng(29.64568, -82.34632))
            .add(new LatLng(29.64565, -82.34650))
            .add(new LatLng(29.64560, -82.34663))
            .add(new LatLng(29.64552, -82.34675))
            .add(new LatLng(29.64547, -82.34679))
            .add(new LatLng(29.64533, -82.34688))
            .add(new LatLng(29.64522, -82.34691))
            .add(new LatLng(29.64513, -82.34691))
            .add(new LatLng(29.64489, -82.34691))
            .add(new LatLng(29.64488, -82.34779))
            .add(new LatLng(29.64490, -82.34860))
            .add(new LatLng(29.64491, -82.34911))
            .add(new LatLng(29.64488, -82.34926))
            .add(new LatLng(29.64489, -82.35014))
            .add(new LatLng(29.64488, -82.35040))
            .add(new LatLng(29.64458, -82.35041))
            .add(new LatLng(29.64214, -82.35046))
            .add(new LatLng(29.64008, -82.35048))
            .add(new LatLng(29.63863, -82.35048))
            .add(new LatLng(29.63684, -82.35021))
            .add(new LatLng(29.63662, -82.35020))
            .add(new LatLng(29.63631, -82.35016))
            .add(new LatLng(29.63596, -82.35010))
            .add(new LatLng(29.63590, -82.35011))
            .add(new LatLng(29.63585, -82.35015))
            .add(new LatLng(29.63581, -82.35023))
            .add(new LatLng(29.63552, -82.35111))
            .add(new LatLng(29.63545, -82.35134))
            .add(new LatLng(29.63535, -82.35132))
            .add(new LatLng(29.63500, -82.35132))
            .add(new LatLng(29.63520, -82.35302))
            .add(new LatLng(29.63526, -82.35355))
            .add(new LatLng(29.63531, -82.35400))
            .add(new LatLng(29.63536, -82.35438))
            .add(new LatLng(29.63423, -82.35760))
            .add(new LatLng(29.63356, -82.35918))
            .add(new LatLng(29.63238, -82.36167))
            .add(new LatLng(29.62975, -82.36727))
            .add(new LatLng(29.62933, -82.36827))
            .add(new LatLng(29.62901, -82.36898))
            .add(new LatLng(29.62846, -82.37018))
            .add(new LatLng(29.62785, -82.37124))
            .add(new LatLng(29.62737, -82.37200))
            .add(new LatLng(29.62680, -82.37260))
            .add(new LatLng(29.62566, -82.37256))
            .add(new LatLng(29.62504, -82.37254))
            .add(new LatLng(29.62394, -82.37262))
            .add(new LatLng(29.62224, -82.37291))
            .add(new LatLng(29.62202, -82.37292))
            .add(new LatLng(29.62145, -82.37292))
            .add(new LatLng(29.62018, -82.37283))
            .add(new LatLng(29.61802, -82.37258))
            .add(new LatLng(29.61788, -82.37383))
            .add(new LatLng(29.61783, -82.37413))
            .add(new LatLng(29.61746, -82.37527))
            .add(new LatLng(29.61742, -82.37552))
            .add(new LatLng(29.61735, -82.37644))
            .add(new LatLng(29.61740, -82.37699))
            .add(new LatLng(29.61746, -82.37723))
            .add(new LatLng(29.61752, -82.37740))
            .add(new LatLng(29.61763, -82.37764))
            .add(new LatLng(29.61790, -82.37803))
            .add(new LatLng(29.61939, -82.37921))
            .add(new LatLng(29.61988, -82.37967))
            .add(new LatLng(29.62041, -82.38007))
            .add(new LatLng(29.62055, -82.38021))
            .add(new LatLng(29.62241, -82.38157))
            .add(new LatLng(29.62274, -82.38195))
            .add(new LatLng(29.62302, -82.38172))
            .add(new LatLng(29.62345, -82.38099))
            .add(new LatLng(29.62536, -82.37969))
            .add(new LatLng(29.62566, -82.37944))
            .add(new LatLng(29.62532028, -82.37863156))
            .color(Color.BLUE)
            .width(5);

    if (bus_no.equals("Bus 12 Reitz Union - Hunters Run")) {
      Polyline polyline = myMap.addPolyline(rectOptions);
      polyline.setGeodesic(true);
    }
  }