Supported Platforms
Developing an application with this library, requires the following:
- Android SDK 4.1 (API Level 16) or later.
- Android plugin for Gradle version 3.0.1 or later.
- Gradle version 4.1 or later.
Sample App
Screen Capture
Getting Started
To make it general, we will make the example using code from the Android Studio. First, download our latest library or grab via gradle.
- Adding our repository url on your root project, build.gradle :
allprojects {
repositories {
google()
jcenter()
maven {
url 'https://archiva.ujuizi.com/repository/internal/'
}
}
}
- Then on your app build.gradle
android {
...
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
...
}
dependencies {
implementation 'com.ujuizi.ramani:maps-api:2.0.1'
}
- Sync your gradle, and now it's on your Android project. For further information about our release version, please visit our Archiva Repository
API-Key
You must provide the API-Key that you get from our client-area webpage before accessing our services. Below is the step-by-step guide to create new API Key:
- Sign in. Or Register first, if you don't have an account yet
- Login to your dashboard.
- Select tab Configuration and your API Key is there.
<!-- For testing, you can also use our testing credential :
- API-Key : 68891c9a8f10e61a4b1ca2d43bb06a00
- Username : ramaniuser
- But you need to set your package name as com.ramani.map' -->
Add API Key on Your Code
After that, you can use our API in your code
RMAccountManager.RMAccountModel rmAccountModel = new RMAccountManager.RMAccountModel("YOUR_USERNAME", "public", "YOUR_API_KEY");
RMAccountManager.init(this, this, rmAccountModel);
Note:
-
public
is the default Schema name.
Sample Codes
Get Ramani Public Layer ID
- Goto Ramani Public Maps
- Click on layer button.
- Select the datasets you want to use.
- Login if you are not loggin yet.
- Draw something on the map.
- Click
get code
button. - You will see the Layer ID and also some code snippet.
- For sample
public.username_SWTRR
.
Get Private Layer ID
- Login to your Ramani Cloud Account
- Click Editor button from your dashboard.
- Select the Database tab.
- The Layer ID is combination of Schema and Table ID, here you schema name.
- This is your layer ID.
- For sample
public.SWTRR
.
Load Basemap And Map Layer (using layerID)
public class MainActivity extends AppCompatActivity
implements RMMapServices.RMServiceListener, RMAccountManager.RMAccountManagerListener{
private String layerID = "YOUR_LAYER_ID";
private Map mMap;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// init map
MapView mMapView = findViewById(R.id.mapView);
mMapView.setMapPosition(new GeoPoint(51.221297, 4.399128), 13);
mMap = mMapView.map();
// adding basemap
UrlTileSource tileSource = DefaultSources.OPENSTREETMAP.build();
tileSource.setHttpRequestHeaders(Collections.singletonMap("User-Agent", "ramani-android-example"));
BitmapTileLayer mBackgroundLayer = new BitmapTileLayer(mMap, tileSource);
mMap.layers().add(mBackgroundLayer);
// authentication before using our services
RMAccountManager.RMAccountModel rmAccountModel = new RMAccountManager.RMAccountModel("YOUR_USERNAME", "public", "YOUR_API_KEY");
RMAccountManager.init(this, this, rmAccountModel);
}
@Override
public void onMapAuthDone(boolean auth) {
// false if auth success and token generated
if (!auth)
return;
RMMapTileLayer rmTileLayer = new RMMapTileLayer(mMap, new RMMapTileSource("YOUR_LAYER_ID"));
rmTileLayer.tileRenderer().setBitmapAlpha(0.5f); // layer opacity, range 0 - 1
mMap.layers().add(2, rmTileLayer); //index hierarchy, 0 is basemap
mMap.render();
}
}
- Explore the maps we have offer in our DDL
Load Map Layer (using OPeNDAP URL)
If you are using OPeNDAP URL, the usage is the same as layerID. You only need to add /wmsmap on the URL.
private Map mMap;
private String url = "https://analytics.ramani.ujuizi.com/SOURCES/.Copernicus/.Land/.LAI/.LAI/wmsmap";
@Override
public void onMapAuthDone(boolean auth) {
RMMapTileLayer rmTileLayer = new RMMapTileLayer(mMap, new RMMapTileSource(url));
mMap.layers().add(2, rmTileLayer); //index hierarchy, 0 is basemap
mMap.render();
}
But sometimes, the OPeNDAP URL can be too long. Therefore, you can use the shorten URL by clicking Get Maps-API Endpoint on your OPeNDAP URL page, Data Files section. And then, copy the URL.
private Map mMap;
private String shortenURL = "https://analytics.ramani.ujuizi.com/goto/c047d9845229cf794e15240e7bd3adbc";
@Override
public void onMapAuthDone(boolean auth) {
mapServices = new RMMapServices();
mapServices.setRMServiceListener(this);
mapServices.getAnalyticsMap(shortenURL); // to decode your shorten URL
}
@Override
public void onStringResult(RMMapServices.Task task, String result) {
if (task.equals(RMMapServices.Task.MAP)) {
RMMapTileLayer rmTileLayer = new RMMapTileLayer(mMap, new RMMapTileSource(result));
mMap.layers().add(2, rmTileLayer); //index hierarchy, 0 is basemap
mMap.render();
}
}
Get Point
To get more features information at a single point. Retrieves data, including geometry and attribute values.
@Override
public void onMapAuthDone() {
RMMapServices mapServices = new RMMapServices();
mapServices.setRMServiceListener(this);
String layerID = "YOUR_LAYER_ID";
GeoPoint point = new GeoPoint(51.221297, 4.399128);
mapServices.getPoint(point, layerID, RMMapInfo.Type.JSON);
}
/**
* Handling service return
* for every service with text format (e.g. XML, JSON, JSON-LD)
* */
@Override
public void onStringResult(RMMapServices.Task task, String result) {
if (task == RMMapServices.Task.POINT_PROFILE) {
// to filter your request
}
}
Note:
- Only support XML, JSON, and JSON-LD.
- setParams method is used to add or change an existing parameters
- For JSON-LD parameter value such as QUERY_LAYERS, LAYERS, or DATASET, please visit our catalog here.
- To get layer capabilities (attribute) or if you want to set custom parameter.
- Explore the maps we have offer in our DDL
Get Point Profile
To get more features information at a single point. Retrieves data, including geometry and attribute values. But unlike Get Point, you can request for multiple different parameter(point, layerID, parameter, and returnType) in 1 request. Recommended for data comparison or animation use case.
@Override
public void onMapAuthDone(booblean auth) {
RMMapServices mapServices = new RMMapServices();
mapServices.setRMServiceListener(this);
if (!RMServicesManager.getToken().isEmpty()) { // true if auth success
ArrayList models = new ArrayList<>();
models.add(new RMServicesModel(new GeoPoint(10.1372, 5.4422), "layerID A", Type.JSON));
models.add(new RMServicesModel(new GeoPoint(12.4353, 5.3422), "layerID A", Type.XML));
models.add(new RMServicesModel(new GeoPoint(12.4353, 5.3422), "layerID B", Type.JSON, new HashMap<>()));
mapServices.getPointProfile(models);
}
}
/**
* Handling service return
* for every service with text format (e.g. XML, JSON, JSON-LD)
* */
@Override
public void onStringResult(RMMapServices.Task task, String result) {
if (task == RMMapServices.Task.POINT_PROFILE) {
// to filter your request
}
}
Note:
- Only support XML, JSON, and JSON-LD.
- For JSON-LD, please see the Get Point example.
- To get layer capabilities (attribute) or if you want to set custom parameter.
- Explore the maps we have offer in our DDL
Adding Marker to the Map
// single marker (without info window information)
Marker mk1 = new Marker(mMapView, this);
mk1.add(new GeoPoint(51.221297, 4.399128));
// using custom DefaultInfoWindow And custom icon
Marker mk2 = new Marker(mMapView, this);
mk2.setInfoWindow(new MyDefaultInfoWindow(mMapView));
mk2.add("Frascati", "Rome Italy", new GeoPoint( 41.806830, 12.675612), getResources().getDrawable(R.drawable.ic_marker));
// or if you want to make marker for multiple location
ArrayList<ExtendedMarkerItem> list = new ArrayList<>();
list.add(new ExtendedMarkerItem(new GeoPoint(51.221297, 4.399128)));
list.add(new ExtendedMarkerItem("Frascati", "Rome Italy",
new GeoPoint(41.806830, 12.67561)));
Marker mk3 = new Marker(mMapView, this, list);
Get Point Cube
The extended version of Get Point Profile. Where you're able to not just get the information on a single point, but also the information of the neighboor GeoPoint, in a 3x3, 5x5, etc bounding box. It would be usefull for a comparison (e.g temperature between all neighboring pixels in a 3x3).
In order to create a grid(rectangular), a bounding box is needed. And every bounding box has a radius, which is the distance from your center point to the outer edge of bounding box. And the diameter, which is the distance between outer edge, or always twice the radius.
The radius value in our API is the latlong distance(e.g. distance from GeoPoint(10.00, 10.00) to GeoPoint(10.00, 10.50) will has 0.5 distance in lon (+- 50Km)). And if you set your radius at 0.5, your diameter(grid width) will be 1. This also means, the distance between bounding box center point in your grid, is 1 (diameter).
private int gridSize = 3;
// radius of your bounding box(bb)
// from the center point to the outher edge of bb
// in latlon distance, 0.5f = +- 50Km
private float radius = 0.5f
private String layerID = "simS3seriesCoverGlobal/coverclass";
@Override
public void onMapAuthDone(boolean auth) {
RMMapServices mapServices = new RMMapServices();
mapServices.setRMServiceListener(this);
ArrayList models = new ArrayList<>();
models.add(new RMServicesModel(new GeoPoint(0.0000, 0.0000), layerID, RMMapInfo.Type.JSON, radius));
mapServices.getPointCube(models, gridSize); // gridSize, only support for odd number and >= 3
}
/**
* Handling service return
* for every service with text format (e.g. XML, JSON, JSON-LD)
* */
@Override
public void onStringArrayResult(RMMapServices.Task task, ArrayList result) {
if (task == RMMapServices.Task.POINT_PROFILE) {
// instead of 1 single point
// for every data request in your model, you will get a gridSize x gridSize (e.g 3x3, 5,5, etc) data
}
}
The code above will give you 9 data points, since you're requesting for 3x3 grid size. The value itself once again, depend on your GeoPoint and Radius.
GeoPoint(-1, -1)
{"type":"FeatureInfoResponse","features":[{"geometry":{"type":"Point","coordinates":[-0.998046875,-1.001953125]},"properties":{"iIndex":64441,"jIndex":32761,"gridCentreLon":-0.9972222202875969,"gridCentreLat":-1.0027777778505822},"featureInfo":[{"time":"2009-01-01T00:00:00.000Z","value":-46}]}]}
GeoPoint(-1, 0)
{"type":"FeatureInfoResponse","features":[{"geometry":{"type":"Point","coordinates":[0.001953125,-1.001953125]},"properties":{"iIndex":64801,"jIndex":32761,"gridCentreLon":0.0027777797232033663,"gridCentreLat":-1.0027777778505822},"featureInfo":[{"time":"2009-01-01T00:00:00.000Z","value":-46}]}]}
...
With the order from the Bottom Left (the lowest coordinate) to Top Right (the higher coordinate). Below is the visualization of the 3x3 grid indices, where the (0,0) is your original GeoPoint:
Note:
- Only support for grid size with odd value and >= 3
- Only support XML, JSON, and JSON-LD.
- For JSON-LD, please see the Get Point example.
- To get layer capabilities (attribute) or if you want to set custom parameter.
- Explore the maps we have offer in our DDL
Get Vertical Profile
To get more features information at a single point(Get Point), along a vertical dimension.
@Override
public void onMapAuthDone(boolean auth) {
RMMapServices mapServices = new RMMapServices();
mapServices.setRMServiceListener(this);
GeoPoint point = new GeoPoint(51.221297, 4.399128);
String layerID = "YOUR_LAYER_ID";
RMMapInfo.Type format = RMMapInfo.Type.JSON;
// supported format : JSON, PNG, SVG
mapServices.getVerticleProfile(point, layerID, format);
}
/**
* Handling service return
* for every service with text format (e.g. XML, JSON, JSON-LD)
* */
@Override
public void onStringResult(RMMapServices.Task task, String result) {
if (task == RMMapServices.Task.VERTICLE) {
// to filter your request
}
}
/**
* for every service with format PNG, SVG
* you can convert the InputStream to Bitmap using our method
* */
@Override
public void onByteResult(RMMapServices.Task task, InputStream result) {
if (task == RMMapServices.Task.VERTICLE)
Bitmap image = RMUtils.convertStreamToBitmap(result);
}
Note:
- Only works on layers that have a temporal dimension (explore the maps we have offer in our DDL), for example nitrates in the depth of the ocean
- Only support for JSON, PNG, and SVG.
- To get layer capabilities (attribute) or if you want to set custom parameter.
Get Time-series Profile
To get more features information at a single point(Get Point), along with variation in time (along a temporal dimension).
@Override
public void onMapAuthDone(boolean auth) {
RMMapServices mapServices = new RMMapServices();
mapServices.setRMServiceListener(this);
GeoPoint point = new GeoPoint(51.221297, 4.399128);
String layerID = "YOUR_LAYER_ID";
RMMapInfo.Type format = RMMapInfo.Type.JSON;
//set time dimension
Map params = new HashMap();
params.put("TIME", "2006-07-28T00:00:00.000Z/2006-08-01T00:00:00.000Z");
mapServices.setParams(params);
// supported format : JSON, PNG, SVG
mapServices.getTimeSeriesProfile(point, layerID, format);
}
/**
* Handling service return
* for every service with text format (e.g. XML, JSON, JSON-LD)
* */
@Override
public void onStringResult(RMMapServices.Task task, String result) {
if (task == RMMapServices.Task.TIME_SERIES) {
// to filter your request
}
}
/**
* for every service with format PNG, SVG
* you can convert the InputStream to Bitmap using our method
* */
@Override
public void onByteResult(RMMapServices.Task task, InputStream result) {
if (task == RMMapServices.Task.TIME_SERIES)
Bitmap image = RMUtils.convertStreamToBitmap(result);
}
Note:
- Only works on layers that have a temporal dimension (explore the maps we have offer in our DDL), for example Leaf Area Index (LAI) over the seasons of the year
- Only support for JSON, PNG, and SVG.
- To get layer capabilities (attribute) or if you want to set custom parameter.
Get Horizontal Profile (GetTransect)
To get more features information at multiple point, along a horizontal dimension. For example, atmospheric ozone along a line (single or multiple segments) crossing a city.
@Override
public void onMapAuthDone(boolean auth) {
RMMapServices mapServices = new RMMapServices();
mapServices.setRMServiceListener(this);
ArrayList points = new ArrayList();
points.add(new GeoPoint(51.221297, 4.399128));
points.add(new GeoPoint(52.596012, 6.295243));
String layerID = "YOUR_LAYER_ID";
RMMapInfo.Type format = RMMapInfo.Type.JSON;
// supported format : JSON, PNG, SVG
mapServices.getTransect(points, layerID, format);
}
/**
* Handling service return
* for every service with text format (e.g. XML, JSON, JSON-LD)
* */
@Override
public void onStringResult(RMMapServices.Task task, String result) {
if (task == RMMapServices.Task.TRANSECT) {
// to filter your request
}
}
/**
* for every service with format PNG, SVG
* you can convert the InputStream to Bitmap using our method
* */
@Override
public void onByteResult(RMMapServices.Task task, InputStream result) {
if (task == RMMapServices.Task.TRANSECT)
Bitmap image = RMUtils.convertStreamToBitmap(result);
}
Note:
- Only support for JSON, PNG, SVG.
- Explore the maps we have offer in our DDL.
- To get layer capabilities (attribute) or if you want to set custom parameter.
Adding Polyline to the Map
Polyline line1 = new Polyline(mMap);
line1.createLine(geoPoints);
//or you can customize it
Polyline line2 = new Polyline(mMap, Color.RED, 2); //map, color, size
line2.createLine(geoPoints);
Get Area Profile
To get more features information at multiple point, along a horizontal dimension. But for an area defined by PolygonOptions.
@Override
public void onMapAuthDone(boolean auth) {
RMMapServices mapServices = new RMMapServices();
mapServices.setRMServiceListener(this);
ArrayList points = new ArrayList();
points.add(new GeoPoint(51.221297, 4.399128));
points.add(new GeoPoint(53.596012, 6.295243));
points.add(new GeoPoint(53.726012, 4.289128));
String layerID = "YOUR_LAYER_ID";
RMMapInfo.Type format = RMMapInfo.Type.JSON;
// supported format : JSON, PNG, SVG
mapServices.getArea(points, layerID, format, RMMapInfo.Return.AGGREGATE);
}
/**
* Handling service return
* for every service with text format (e.g. XML, JSON, JSON-LD)
* */
@Override
public void onStringResult(RMMapServices.Task task, String result) {
if (task == RMMapServices.Task.AREA) {
// to filter your request
}
}
/**
* for every service with format PNG, SVG
* you can convert the InputStream to Bitmap using our method
* */
@Override
public void onByteResult(RMMapServices.Task task, InputStream result) {
if (task == RMMapServices.Task.AREA)
Bitmap image = RMUtils.convertStreamToBitmap(result);
}
Note:
- Only support for JSON, PNG, SVG.
- Only support for dataType : ALL, HISTOGRAM, and AGGREGATE.
- Explore the maps we have offer in our DDL.
- To get layer capabilities (attribute) or if you want to set custom parameter.
Return Example :
{
"type": "GetAreaResponse",
"area": {
"crs": "EPSG:4326",
"linestring": "3.53759765625 47.79839667295524,4.556673569110679 48.07338898931344,3.4914556008582487 47.49998727341379,5.2789456005429924 47.913809258555474,3.3776305571161824 46.756562106822706,5.6348949137565185 47.21247952521911,3.787219268892672 46.519273910457045,4.775344730497775 46.848707252177114,4.775344730497775 46.848707252177114,",
"dataset": "Sentinel-3: Global Nighttime Lights",
"variable": "Nighttime Lights",
"units": "",
"aggregate": {
"mean": 6.622666666666683,
"stdv": 8.875178801281983,
"skew": 2.6443954084095673,
"kurt": 9.388449667730299,
"min": 0,
"max": 61,
"perc": 6,
"median": 6
}
}
}
Adding Polygon to the Map
Polygon polygon1 = new Polygon(mMap);
polygon1.createPolygon(geoPoints);
// or you can customize it with your own style
Polygon polygon2 = new Polygon(mMap, Style.builder()
.strokeColor(0)
.strokeWidth(2)
.fillColor(Color.RED)
.build()));
polygon2.createPolygon(geoPoints);
Get Layer Attributes(GetMetadata)
To requests metadata (e.g. date-range, layer details, units, etc.) from layer dataset. For example, to obtain the temporal range of a time-series required by getTimeseriesProfile use (TIME
), or to get the extremes of a layer (Min
), and (Max
) to set the scaleRange parameter.
@Override
public void onMapAuthDone(boolean auth) {
RMMapServices mapServices = new RMMapServices();
mapServices.setRMServiceListener(this);
String layerID = "YOUR_LAYER_ID";
mapServices.getLayerAttributes(layerID);
}
/**
* Handling service return
* for every service with text format (e.g. XML, JSON, JSON-LD)
* */
@Override
public void onStringResult(RMMapServices.Task task, String result) {
if (task == RMMapServices.Task.LAYER_ATTR) {
// to filter your request
}
}
Note:
- Only support JSON.
- For more information about which parameters you can get follow this link.
- Explore the maps we have offer in our DDL.
Get dates for timeseries and return as RSS or ISO8601 format
Using Get Layer Attributes method, below is the example to get (TIME
) for Get Time-series Profile:
@Override
public void onMapAuthDone(boolean auth) {
if (!auth) { // false if auth success
return;
String layerID = "YOUR_LAYER_ID";
Map params = new HashMap();
params.put("item", "dates");
params.put("format", "rss"); //with : RSS, without : ISO8601
mapServices.setParams(params);
mapServices.getLayerAttributes(layerID);
}
/**
* For Text format
* */
@Override
public void onStringResult(RMMapServices.Task task, String result) {
if (task == RMMapServices.Task.LAYER_ATTR) {
try{
JSONObject metadata = new JSONObject(result);
String numColorBands = metadata.getString("numColorBands");
String time = metadata.getString("nearestTimeIso");
String defaultPalette = metadata.getString("defaultPalette");
} catch (Exception e) {
e.printStackTrace();
}
}
}
Note:
- Only support JSON.
- For more information about which parameters you can get follow this link.
- Explore the maps we have offer in our DDL.
Set Parameter
Set Parameter is used to add or replace existing parameters, to make your requested data richer and more dynamic. Make sure to call setParams(params)
before executing your request, or the API will use your default parameter.
Map params = new HashMap();
params.put("ELEVATION", "1");
params.put("TIME", "2006-07-28T00:00:00.000Z/2006-08-01T00:00:00.000Z");
mapServices.setParams(params);
GeoPoint point = new GeoPoint(51.221297, 4.399128);
String layerID = "YOUR_LAYER_ID";
mapServices.getTimeSeriesProfile(point, layerID, RMMapInfo.Type.JSON);
- The example above use param (
TIME
) to set the temporal range of a time-series. - For more information about which parameters you can set, follow this link.
- Explore the maps we have offer in our DDL.
Manipulate Your Data in Our Cloud
With this method, you can do CRUD (Create, Read, Update, Delete) to your dataset. The first example shows how to search for a feature in a layer and show it on the map, the second shows how to insert a new point (i.e. GPS-location).
@Override
public void onMapAuthDone(boolean auth) {
// init our service and the listener
RMMapServices mapServices = new RMMapServices();
mapServices.setRMServiceListener(this);
String query = "SELECT * FROM public.ec_example WHERE round(ST_Distance(ST_Transform(\"the_geom\",3857),
'ST_GeomFromText('POINT(551569.5961058318 6701998.640044251)',3857))) < 6114.9622628
ORDER BY round(ST_Distance(ST_Transform(\"the_geom\",3857),
ST_GeomFromText('POINT(551569.5961058318 6701998.640044251)',3857)))LIMIT 5";
mapServices.sqlApi(query);
}
- Basically, you're using PostgreSQL query syntax
- Only work for dataset/layer under your account(private)
- Explore the maps we have offer in our DDL.
Store Geometry Data
Store your single point or multiple point such as linestring, polygon, multipolygon, etc on our Cloud Service as Geometry data.
@Override
public void onMapAuthDone(boolean auth) {
//for single coordinate and without any parameter
mapServices.store("YOUR_LAYER_ID", new GeoPoint(52.4024, 6.0370), new HashMap());
// or multiple coordinate and with added parameter
Map fields = new HashMap();
fields.put("id", "7");
fields.put("name", "Geometry A");
ArrayList points = new ArrayList();
points.add(new GeoPoint(52.4024, 6.0370));
points.add(new GeoPoint(52.5960, 6.2952));
points.add(new GeoPoint(52.5028, 6.7044));
points.add(new GeoPoint(52.3269, 6.9077));
points.add(new GeoPoint(52.1840, 6.6742));
points.add(new GeoPoint(52.2160, 6.2787));
// for multiple coordinate you need to specify the DataType
// MULTILINESTRING, MULTIPOLYGON, POLYGON, etc
mapServices.store("YOUR_LAYER_ID", points, fields, RMMapInfo.DataType.MULTILINESTRING);
}
@Override
public void onStringResult(RMMapServices.Task task, String result) {
if (task == RMMapServices.Task.STORE)
// to see if your request is success
}
- Only work for dataset/layer under your account(private)
- If you do not have any dataset in your account, in your account go to
Editor >> Database
SPARQL API
With this method, you are able to get the RDF data
, through our API using a SPARQL
query.
@Override
public void onMapAuthDone() {
// init our service and the listener
RMMapServices mapServices = new RMMapServices();
mapServices.setRMServiceListener(this);
String dataset = "LaiPalermoLdt";
String query = "select * where { ?s ?p ?o } limit 10";
mapServices.sparqlApi(dataset, query);
}
@Override
public void onStringResult(RMMapServices.Task task, String result) {
if (task == RMMapServices.Task.SPARQL)
Log.d(TAG, task.name() + " : " + result);
}
For the dataset
value, you can get it by following this step:
- Go to our SOURCES, and look for small dataset. Here for example.
- Click on Create SPARQL EndPoint. Note! Only works for small datasets, so make sure you subset a dataset by space and time so a manageable dataset results.
- Input your data, especially SPARQL Endpoint Name. Since this will be your dataset name
- Press Create Endpoint URL. And copy the URL from the generated Endpoint
- Done. For further information about this API, you can also check one of our documentation here
Get Legend Graphic
The GetLegendGraphic method itself is optional for an SLD-enabled WMS. It provides a general mechanism for acquiring legend symbols, beyond the LegendURL reference of WMS Capabilities. Servers supporting the GetLegendGraphic call might code LegendURL references as GetLegendGraphic for interface consistency.
@Override
public void onMapAuthDone(boolean auth) {
String layerID = "YOUR_LAYER_ID"
mapServices.getLegendGraphic(layerID);
}
@Override
public void onByteResult(RMMapServices.Task task, InputStream result) {
if (task == RMMapServices.Task.LEGEND_GRAPHIC)
image.setImageBitmap(RMUtils.convertStreamToBitmap(result));
}
- For different pallete, you can use setParams and set the pallete value into your preference
- Explore the maps we have offer in our DDL.
Get Mosaic
Ramani Maps-API for Android offers a set of online services to grab the Sentinel-2 image data as GeoTIFFs (16-bit) for an AOI (area of interest). (See getMosaic)
@Override
public void onMapAuthDone() {
RMMapServices mapServices = new RMMapServices();
mapServices.setRMServiceListener(this);
BoundingBox boundingBox = getBoundingBox(new GeoPoint(52.3547031, 4.8339211), 5);
mapServices.getMosaic(boundingBox, 1759, 955, "image.png", "2017-09-08T00:00:00", "2019-10-09T00:00:00", 0,
RMMapInfo.Type.PNG);
}
@Override
public void onByteResult(RMMapServices.Task task, InputStream result) {
// for image, e.g PNG & SVG
Log.e("onByteResult", "result : " + result.toString());
AlertDialog.Builder builder = new AlertDialog.Builder(this);
ImageView imageView = new ImageView(this);
builder.setView(imageView);
builder.setTitle("GetMosaic");
imageView.setImageBitmap(convertStreamToBitmap(result));
builder.setCancelable(true);
builder.setPositiveButton("OK", null);
builder.show();
}
Note:
- Parameter cloudinnes is the maximum acceptable percentage of the image covered by clouds ('cloudiness') with a value between 0-100.
- BBOX is lower-left (LL) and upper-right (UR) as concatenated string: LEFT,BOTTOM,RIGHT,TOP Where LL and UR are in decimal degrees Geograpahic Coordinates (WGS84)
- Parameter cloudinnes is the maximum acceptable percentage of the image covered by clouds ('cloudiness') with a value between 0-100.
- Optional parameter FORMAT can be use to get other image format with value image/png (default is TIFF format)
- Explore the GetMosaic, and How to Get Image on RAMANI Clouds
Known Uses
- Has been used in many previous apps developed at ESA Space App Camp
- Dehydromatic App [brochure]
- CHEETAH App [slide]
- Ramani Location Manager App [brochure]
- Walkability App [brochure]
Known Issues
On every development project, you can get a fault or defect in a system or machine. For further information about our current development progress, please check our open issues.
<!--
See Also
-->
License
Copyright (c) 2017 RAMANI B.V.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.