Question

I have imported clusterkraf in my maps v2 project .Now how do I add latlng points ?

I have added this code and I dont know how to add 10 lat lng points .
I never really found any approach other than the code below.I really appreciate any help .

Thanks in Advance.

  public class YourMapPointModel {
        public LatLng latLng;
        public YourMapPointModel(LatLng latLng) {
            this.latLng = latLng;
        }
        // encapsulation omitted for brevity
    }

    public class YourActivity extends FragmentActivity {
        YourMapPointModel[] yourMapPointModels = new YourMapPointModel[] { new YourMapPointModel(new LatLng(0d, 1d) /* etc */ ) };
        ArrayList<InputPoint> inputPoints;

        private void buildInputPoints() {
            this.inputPoints = new ArrayList<InputPoint>(yourMapPointModels.length);
            for (YourMapPointModel model : this.yourMapPointModels) {
                this.inputPoints.add(new InputPoint(model.latLng, model));
            }
        }



        Clusterkraf clusterkraf;

        private void initClusterkraf() {
            if (googleMap != null && this.inputPoints != null && this.inputPoints.size() > 0) {
                com.twotoasters.clusterkraf.Options options = new com.twotoasters.clusterkraf.Options();
                // customize the options before you construct a Clusterkraf instance
                this.clusterkraf = new Clusterkraf(googleMap, options, this.inputPoints);
            }
        }

    }
Was it helpful?

Solution

You could use following code for point:

        Position_mark = new LatLng(35.7008, 51.437);
        Marker hamburg = map.addMarker(new MarkerOptions().position(
                Position_mark).title("Hamburg"));

        Position_Now = Position_mark;
        map.moveCamera(CameraUpdateFactory.newLatLngZoom(Position_mark,
                15));

        map.animateCamera(CameraUpdateFactory.zoomTo(10), 2000, null);

and put coomands in for(;;).....that add 10 points

OTHER TIPS

Test Google Direction Library for Routing Points in Google Maps V2

https://github.com/jd-alexander/Google-Directions-Android

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top