GeoAnalytics
Introductionβ
This API gives the users the power to display, style, and edit the data which is archived in
Mappls Database and overlay it on the user created maps.
- Enables data selection, visualization, queries & styling with rich base map available at various level of granularity
- Build maps quickly and easily without coordinates, using country, pin codes or simply place names
- Drill and analyze different type of map layers such as districts, pincode, villages, city etc at Pan India level or restricted to limited bound /Area of interest
- Allows user to set their own styling parameters such as label color scheme, geometry color schemes, opacity, width, stroke etc.
- Allows to create rich thematic visuals using combination of value ranges
This API gets the layer specified which is stored in Mappls Database and gives a WMS layer as an output with any filters or styles specified by the user.
Add the dependencyβ
Add below dependency in app level build.gradle file
implementation 'com.mappls.sdk:geoanalytics-plugin:1.0.0'
Available Geoanalytics Layerβ
MapplsGeoAnalyticsType.STATE
MapplsGeoAnalyticsType.DISTRICT
MapplsGeoAnalyticsType.SUB_DISTRICT
MapplsGeoAnalyticsType.WARD
MapplsGeoAnalyticsType.LOCALITY
MapplsGeoAnalyticsType.PANCHAYAT
MapplsGeoAnalyticsType.BLOCK
MapplsGeoAnalyticsType.PINCODE
MapplsGeoAnalyticsType.TOWN
MapplsGeoAnalyticsType.CITY
MapplsGeoAnalyticsType.VILLAGE
MapplsGeoAnalyticsType.SUB_LOCALITY
MapplsGeoAnalyticsType.SUB_SUB_LOCALITY
To get the detailed list of available layer's and attribute's names, please use the Listing API available here.β
Now that youβre all caught up with the features, let's get down right to them and look at how you can integrate our Geoanlytics API to add data on your map in few simple steps.
Step-1 Initialize GeoAnalytics Managerβ
Javaβ
MapplsGeoAnalyticsPlugin geoAnalyticsPlugin = new MapplsGeoAnalyticsPlugin(mapView, mapplsMap);
Kotlinβ
val geoAnalyticsPlugin = MapplsGeoAnalyticsPlugin(mapView, mapplsMap)
Step-2 Show GeoAnalytics layerβ
Javaβ
geoAnalyticsPlugin.showGeoAnalytics(MapplsGeoAnalyticsType.STATE, MapplsGeoAnalyticsRequest.builder().attribute("t_p").query(">0").geoboundType("stt_nme").geoBound("HARYANA", "KERALA")
.propertyNames("stt_nme", "stt_id").style(new GeoAnalyticsAppearanceOption().fillColor("42a5f4").fillOpacity(0.5).strokeColor("000000").labelSize(10).strokeWidth(0).labelColor("000000")).build());
Kotlinβ
geoAnalyticsPlugin.showGeoAnalytics(MapplsGeoAnalyticsType.STATE, MapplsGeoAnalyticsRequest.builder().attribute("t_p").query(">0").geoboundType("stt_nme").geoBound("HARYANA", "KERALA")
.propertyNames("stt_nme", "stt_id").style(new GeoAnalyticsAppearanceOption().fillColor("42a5f4").fillOpacity(0.5).strokeColor("000000").labelSize(10).strokeWidth(0).labelColor("000000")).build()))
Step-3 MapplsGeoAnalyticsRequestβ
geoboundType(String...)
(Mandatory): The type of geographical extents on which data would be bound, i.e. the parent layer types (India, State, District, Sub District, etc.)geoBound(String...)
(Mandatory): The values of the extent depending on the GeoBoundType.propertyNames(String...)
(Mandatory): Attribute names that user wants to show in info window or in click callbackattribute(String)
: The name of Attribute to filter the output, such as population or number of households.query(String)
: A string containing an operator and a value which would be applied to the attribute filter. Applicable queries include< (Less than) OR >
(Greater then) OR<>
(Between). Example 1:β> 10000β
Example 2: BETWEEN value1 AND value2
*Note: Query is mandatory if Attribute is given.style(GeoAnalyticsStyleOption)
: Options to set the style of LayerGeoAnalyticsAppearanceOptionβ
labelColor(String)
: Value of the color of label.labelSize(Integer)
: Size of labels to be displayed.fillColor(String)
: Value of the polygon/point color. e.g., fillColor("42a5f4")pointSize(Integer)
: Size of point data. (Applicable for Point geometry only)strokeColor(String)
: Value of the color of the label.strokeWidth(Double)
: Width of the polygon border.fillOpacity(Double)
: Opacity value of whole layer. (Any range between 0 & 1) *Note: All starred parameters are mandatory if Style is given.
That's All!
Other Methods Available are:β
1. Remove Geoanalytics Layerβ
Javaβ
geoAnalyticsPlugin.removeGeoAnalytics(MapplsGeoAnalyticsType.STATE);
Kotlinβ
geoAnalyticsPlugin.removeGeoAnalytics(MapplsGeoAnalyticsType.STATE)
2. GeoAnalytics Layer Clickβ
geoAnalyticsPlugin.setGeoAnalyticsCallback(new MapplsGeoAnalyticsCallback() {
@Override
public void getSelectedFeatures(List<MapplsGeoAnalyticsDetail> result) {
}
});
3. Custom Info Windowβ
geoAnalyticsPlugin.setCustomGeoAnalyticsInfoWindowAdapter(new CustomGeoAnalyticsInfoWindowAdapter() {
@Override
public View setCustomInfoWindow(List<MapplsGeoAnalyticsDetail> result) {
return view;
}
});
Mappls GeoAnalytics Listing API
Geo-Analytics API is an API set that gives the users the power to display & style the data which is archived in Mappls pan-India database and overlay it on Mappls Interactive Maps JS API for web.
Listing API is an API that gives the users information on the different layers & attributes available within Geo-Analytics Core APIs. This API acts as an assisting API to quickly get the necessary details that are required to accurately fetch the required overlays from the core Geo-Analytics APIs.
It that provide list of attributes along with unique ID. User can get bounding box of the required feature/area as well.
MapplsGeoAnalyticsList mapplsGeoAnalyticsList = MapplsGeoAnalyticsList.builder()
.api("state")
.attributes("b_box")
.geoBound(geobound)
.geoBoundType(geoboundType)
.build();
MapplsGeoAnalyticsListManager.newInstance(mapplsGeoAnalyticsList).call(new OnResponseCallback<GeoAnalyticsListResponse>() {
@Override
public void onSuccess(GeoAnalyticsListResponse geoAnalyticsListResponse) {
//Handle response
}
@Override
public void onError(int i, String s) {
}
});
Request Parametersβ
api(String)
: api layer name (such as state, district, subdistrict, village, pincode etc)geoBoundType(String)
: Single valued parent type, for example: stt_nme, dst_nme, sdb_nme etc.
Note: For parent type reference, contact apisupport@mappls.comgeoBound(String...)
: child values, for example: Haryana, Maharashtra, Goa etcattributes(String...)
: field name/bounding Box requested w.r.t api (api) & parent type (geo_bound_type). Bounding box can be requested as "b_box" variable.
Response Parametersβ
responseCode(Integer)
: The response code of the operation. The 400 series is for client side (application end) error while 500 series is for server side (Mappls) error, 200 series is for success.version(String)
: The version of the API youβre connected to.totalFeatureCount(Integer)
: total number of features in the request.results(GeoAnalyticsListResult)
GeoAnalyticsListResultβ
apiName(String)
: as requestedattribute(String)
: as requestedgetAttrValues(List<GeoAnalyticsValue>)
GeoAnalyticsValueβ
geoBound(String)
: child valuegetAttrValues(List<Map<String, Object>>)
: list of names/b_box requested