Giter VIP home page Giter VIP logo

arcgis-android-cluster's Introduction

ArcGIS-Android-Cluster

使用ArcGIS Runtime SDK for Android实现的点聚合。

版本要求

ArcGIS Runtime SDK for Android 100.5

GraphicsOverlay效果图

效果图

生成随机点

for (int i = 0; i < 1000; i++) {
    double lat = Math.random() + 39.474923;
    double lon = Math.random() + 116.027116;
    Point point = new Point(lon, lat, mMapView.getSpatialReference());
    Graphic gra = new Graphic(point, simpleMarkerSymbol);
    graphicsOverlay.getGraphics().add(gra);
}

地图比例尺变化

mapView.addMapScaleChangedListener(new MapScaleChangedListener() {
    @Override
    public void mapScaleChanged(MapScaleChangedEvent mapScaleChangedEvent) {
        if (!mapView.isNavigating()) {
            //do you something
        }
    }
});

支持FeatureLayer

效果图

FeatureLayer的查询

private void _clusterFeatures() {
    QueryParameters queryParameters = new QueryParameters();
    queryParameters.setGeometry(_mapView.getVisibleArea());
    queryParameters.setReturnGeometry(true);
    final ListenableFuture<FeatureQueryResult> futures =
            _featureLayer.getFeatureTable().queryFeaturesAsync(queryParameters);
    // add done loading listener to fire when the selection returns
    futures.addDoneListener(new Runnable() {
        @Override
         public void run() {
            try {
                //call get on the future to get the result
                FeatureQueryResult result = futures.get();
                // create an Iterator
                Iterator<Feature> iterator = result.iterator();
                Feature feature;
                // cycle through selections
                int counter = 0;
                while (iterator.hasNext()) {
                    feature = iterator.next();
                    _GraphicsOverlay.getGraphics().add(new Graphic(feature.getGeometry()));
                    counter++;
                }
                _clusterGraphics();
            } catch (Exception e) {
                Log.d("cluster", e.getLocalizedMessage());
            }
        }
    });
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.