Child pages
  • Interoperability API

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Section
Column
width30%
Page Tree
rootGVMN:Documentation
expandCollapseAlltrue
startDepth0
Column
width70%

Interoperability API

Warning

Just added some non formal specs for some parts of the API.
COMPLETE ME!

Introduction

The Android SDK provides a set of APIs to facilitate apps interoperate among them. Some of those APIs are Intents , Services or Broadcast Receivers

The idea is to provide gvSIG Mini with a simple API based on the Android SDK interoperability mechanisms so a third party app could easily consume some of the functionalities of gvSIG Mini. The API should be as generic as possible so any other GIS Android app could implement it.

Info

Non formal specs:

  • Show map: Just opens the map
  • Show location: Shows a given location in the map. Should we use geoURI? inputs: longitude, latitude, zoom level. Optional inputs: layer name (i.e. OPEN STREET MAP), forceGPSLocation (will show the location given by the GPS)
  • Show marker: Shows the map centered in a given location, shows a marker and a return activity. inputs: same as Show Location + marker img (path to a png to symbolize the marker) + description (text to show in the popup) + returnActivity (name of the activity to return when the user taps on the marker). Optional inputs: properties (key-value pairs of properties to attach to the marker) in this case the returnActivity class has no sense as the properties will be shown in a gvSIG Mini activity.
    This action should be easily extandable to provide a list of points, lines or polygons
  • Get point: Opens the map, the user touches a point and returns the coordinates to the return activity. Outputs: longitude, latitude
  • Get GPS locations: Should this be a service?
  • Distance in meters between two points.
  • Orientation between two points
  • Open a vector file from the SD card (KML, GML, GPX, GeoJSON, SHP, ...): Provide the path of a file in the SD card, gvSIG Mini automatically selects the driver and shows the layer. It will be usefull provide the return Activity, so any time a feature is selected in the map, gvSIG Mini will return the feature (geometry + properties) to the return activity.
  • Open a remote vector file: Same as previous but should we use geoURI?
  • Export a file to another file type
  • Export an in memory loaded layer to a file type
  • Configure automatically a WMS server from a link from a webpage (or more general from a URI). There are many web pages from SDIs that publish their WMS urls and provide a link to the getCapabilities request. gvSIG Mini should register to that kind of URI and automatically call the getCapabilities to configure the layer.
  • Reverse geocode: Given a location return the place name and the service that provides it (geonames, nominatim, google, yahoo, etc.)
  • Geocode: Given a place name return the coordinates and the service that provides them.
    Those two operations could be services or an action that shows in the map the location and a popup with the description of the location
  • Move a point: Given a point, the action opens the map and the user can move the point to another location. The output will be the new location of the point.
  • Draw geometry: An action to open the map and as the user touches the screen a geometry is drawn. It could be configurable to draw a single point, multipoints, line(s) or polygon(s). When the drawing has finished it backs to the return activity in the intent.
  • Export map as PNG: Given a location, request the map to the map server and save as PNG to the SD card.
  • Register to filesystem (or web) URIs of files that gvSIG Mini can open (.kml, .gml, .gpx, .geoJSON, .shp...)
  • Think in common intents for JTS Geometry operations (contains, buffer, touches, intersects, etc.). Usually the inputs are two geometries and the outputs a boolean or a geometry.

Define above a set of actions, categories, extra data, etc... based on these specs.

Intent actions

ACTION_SHOW_MAP
  • Activity Action: Just opens the gvSIG Mini Map Activity with the latest state stored by the app
  • Input: nothing
  • Output: nothing
  • Constant value: "mini.intent.action.SHOW_MAP"
ACTION_SHOW_LOCATION
  • Activity Action: Opens the Map Activity centered on some location
  • Input: A longitude (EXTRA_LONGITUDE), latitude (EXTRA_LATITUDE) and zoom level (EXTRA_ZOOMLEVEL).
  • Output: nothing
  • Constant value: "mini.intent.action.SHOW_LOCATION"

Extras

Info

Define here extra_data to provide with the intent actions

EXTRA_LATITUDE
  • A double value representing a latitude coordinate.
  • Constant value: "mini.intent.extra.LATITUDE"
EXTRA_LONGITUDE
  • A double value representing a longitude coordinate.
  • Constant value: "mini.intent.extra.LONGITUDE"
EXTRA_ZOOMLEVEL
  • An int value representing a zoom level.
  • Constant value: "mini.intent.extra.ZOOMLEVEL"
EXTRA_BOUNDING_BOX
  • An array of doubles that specifies a bounding box as follows:
    • Position 0 represents the minimum X.
    • Position 1 represents the minimum Y.
    • Position 2 represents the maximum X.
    • Position 3 represents the maximum Y.
  • Name of the variable: "mini.intent.extra.BOUNDING_BOX"
  • Example:
    double[] value = new double[]{39,0,41,1};
    Intent myIntent = new Intent();
    Intent.putExtra("mini.intent.extra.BOUNDING_BOX",value);
EXTRA_CALLBACK_DESTINATION_NAME
  • A string value with the name of the target Activity in the Third-Party application.
  • Name of the variable: "mini.intent.extra.CALLBACK_NAME_DESTINATION"
  • Example:
    String value="Back";
    Intent myIntent=new Intent();
    Intent.putExtra("mini.intent.extra. CALLBACK_NAME_DESTINATION",value);
EXTRA_CALLBACK_OPERATION_NAME
  • A string value with the name of the operation that will allow user to return to the origin application.
  • Name of the variable: "mini.intent.extra.CALLBACK_OPERATION_NAME"
  • Example:
    String value="Back";
    Intent myIntent=new Intent();
    Intent.putExtra("mini.intent.extra. CALLBACK_OPERATION_NAME",value);
EXTRA_DESTINATION_FILE_FORMAT
  • A string value with the format of the file that has to be created.
  • Name of the variable: "mini.intent.extra.DESTINATION_FILE_FORMAT"
  • Example:
    String value="kml";
    Intent myIntent=new Intent();
    Intent.putExtra("mini.intent.extra.DESTINATION_FILE_FORMAT",value);
EXTRA_DESTINATION_POINT_COLOR
  • A string value with the color of the point icon.
  • Name of the variable: "mini.intent.extra.DESTINATION_POINT_COLOR"
  • Example:
    String value="#00FF00";
    Intent myIntent=new Intent();
    Intent.putExtra("mini.intent.extra.DESTINATION_POINT_COLOR",value);
EXTRA_DESTINATION_POINT_ICON
  • A string value with the path of a .PNG. This .PNG that is located in the SD Card symbolizes the point.
  • Name of the variable: "mini.intent.extra.DESTINATION_POINT_ICON"
  • Example:
    String value=Environment.getExternalStorageDirectory().toString()+"myapp/pointicon.png";
    Intent myIntent=new Intent();
    Intent.putExtra("mini.intent.extra.DESTINATION_POINT_ICON",value);
EXTRA_DESTINATION_TEXT_POPUP
  • A string value with the words to be included in the popup.
  • Name of the variable: "mini.intent.extra.DESTINATION_TEXT_POPUP"
  • Example:
    String value="Home";
    Intent myIntent=new Intent();
    Intent.putExtra("mini.intent.extra.DESTINATION_TEXT_POPUP",value);
EXTRA_END_LATITUDE
  • A double value with a latitude coordinate.
  • Name of the variable: "mini.intent.extra.END_LATITUDE"
  • Example:
    double value=38;
    Intent myIntent=new Intent();
    Intent.putExtra("mini.intent.extra.END_LATITUDE",value);
EXTRA_END_LONGITUDE
  • A double value with a longitude coordinate.
  • Name of the variable: "mini.intent.extra.END_LONGITUDE"
  • Example:
    double value=1;
    Intent myIntent=new Intent();
    Intent.putExtra("mini.intent.extra.END_LONGITUDE",value);
EXTRA_FAST_ROUTE
  • A boolean value that allows developers to specify if they want to get the fast route between two points.
  • Name of the variable: "mini.intent.extra.FAST_ROUTE"
  • Example:
    boolean value=true;
    Intent myIntent=new Intent();
    Intent.putExtra("mini.intent.extra.FAST_ROUTE",value);
EXTRA_GET_DISTANCE_IN_MILES
  • A boolean value that allows developers to specify if they want to receive the result in miles instance of meters.
  • Name of the variable: "mini.intent.extra.GET_DISTANCE_IN_MILES"
  • Example:
    boolean value=true;
    Intent myIntent=new Intent();
    Intent.putExtra("mini.intent.extra.GET_DISTANCE_IN_MILES",value);
EXTRA_LATITUDE
  • A double value with a latitude coordinate.
  • Name of the variable: "mini.intent.extra.LATITUDE"
  • Example:
    double value=39;
    Intent myIntent=new Intent();
    Intent.putExtra("mini.intent.extra.LATITUDE",value);
EXTRA_LAYER_NAME
  • A string value with the title of the layer.
  • Name of the variable: "mini.intent.extra.LAYER_NAME"
  • Example:
    String value="Your current location";
    Intent myIntent=new Intent();
    Intent.putExtra("mini.intent.extra.LAYER_NAME",value);
EXTRA_LONGITUDE
  • A double value with a longitude coordinate.
  • Name of the variable: "mini.intent.extra.LONGITUDE"
  • Example:
    double value=1;
    Intent myIntent=new Intent();
    Intent.putExtra("mini.intent.extra.LONGITUDE",value);
EXTRA_MEAN_OF_TRANSPORT
  • A string value with the mean of transport that user will use to travel between the points of a route.
  • Name of the variable: "mini.intent.extra.MEAN_OF_TRANSPORT"
  • Example:
    String value="On foot";
    Intent myIntent=new Intent();
    Intent.putExtra("mini.intent.extra.MEAN_OF_TRANSPORT",value);
EXTRA_NUMBER_OF_GEOMETRIES
  • A int value value with the number of geometries that are going to be drawn.
  • Name of the variable: "mini.intent.extra.NUMBER_OF_GEOMETRIES"
  • Example:
    int value="5";
    Intent myIntent=new Intent();
    Intent.putExtra("mini.intent.extra.NUMBER_OF_GEOMETRIES",value);
EXTRA_ORIGIN_FILE_FORMAT
  • A string value with the format of the file that has to parsed.
  • Name of the variable: "mini.intent.extra.ORIGIN_FILE_FORMAT"
  • Example:
    String value="kml";
    Intent myIntent=new Intent();
    Intent.putExtra("mini.intent.extra.ORIGIN_FILE_FORMAT",value);
EXTRA_ORIGIN_FILE_PATH
  • A string value with the path of a file.
  • Name of the variable: "mini.intent.extra.ORIGIN_FILE_PATH"
  • Example:
    String value=Environment.getExternalStorageDirectory().toString()+"myapp/points.kml";
    Intent myIntent=new Intent();
    Intent.putExtra("mini.intent.extra.ORIGIN_FILE_PATH",value);
EXTRA_ORIGIN_POINT_COLOR
  • A string value with the color of the point icon.
  • Name of the variable: "mini.intent.extra.ORIGIN_POINT_COLOR"
  • Example:
    String value="#FF0000";
    Intent myIntent=new Intent();
    Intent.putExtra("mini.intent.extra.ORIGIN_POINT_COLOR",value);
EXTRA_ORIGIN_POINT_ICON
*
  • A string value with the path of a .PNG. This .PNG that is located in the SD Card symbolizes the point.
  • Name of the variable: "mini.intent.extra.ORIGIN_POINT_ICON"
  • Example:
    String value=Environment.getExternalStorageDirectory().toString()+"myapp/pointicon.png";
    Intent myIntent=new Intent();
    Intent.putExtra("mini.intent.extra.ORIGIN_POINT_ICON",value);
EXTRA_ORIGIN_TEXT_POPUP
  • A string value with the words to be included in the popup.
  • Name of the variable: "mini.intent.extra.ORIGIN_TEXT_POPUP"
  • Example:
    String value="UPV";
    Intent myIntent=new Intent();
    Intent.putExtra("mini.intent.extra.ORIGIN_TEXT_POPUP",value);
EXTRA_OUTPUT_OK
  • A boolean variable that confirms that the service used worked well.
  • Name of the variable: "mini.intent.extra.OUTPUT_OK"
  • Example:
    Intent obtained=getIntent();
    boolean serviceResult=obtained.getBooleanExtra("mini.intent.extra.OUTPUT_OK",false);
EXTRA_OUTPUT_ERROR
  • A boolean variable that confirms that the used service didn't work.
  • Name of the variable: "mini.intent.extra.OUTPUT_ERROR"
  • Example:
    Intent obtained=getIntent();
    boolean serviceResult=obtained.getBooleanExtra("mini.intent.extra.OUTPUT_ERROR",false);
EXTRA_OUTPUT_INFO
  • A string value that complements EXTRA_OUTPUT_OK or EXTRA_OUTPUT_ERROR with a message.
  • Name of the variable: "mini.intent.extra.OUTPUT_INFO"
  • Example:
    Intent obtained=getIntent();
    String serviceInfoResult=obtained.getStringExtra("mini.intent.extra.OUTPUT_INFO");
EXTRA_PLACE_NAME
  • A string value with the name of a place.
  • Name of the variable: "mini.intent.extra.PLACE_NAME"
  • Example:
    String value="UPV";
    Intent myIntent=new Intent();
    Intent.putExtra("mini.intent.extra.PLACE_NAME",value);
EXTRA_POINT_ICON
  • A string value with the path of a .PNG. This .PNG that is located in the SD Card and symbolizes the point.
  • Name of the variable: "mini.intent.extra.POINT_ICON"
  • Example:
    String value=Environment.getExternalStorageDirectory().toString()+"myapp/pointicon.png";
    Intent myIntent=new Intent();
    Intent.putExtra("mini.intent.extra.POINT_ICON",value);
EXTRA_POINT_ID
  • A string value with the ID of the point. This id will be returned to the third-party application.
  • Name of the variable: "mini.intent.extra.POINT_ID"
  • Example:
    String value="259";
    Intent myIntent=new Intent();
    Intent.putExtra("mini.intent.extra.POINT_ID",value);
EXTRA_POPUP_TEXT
  • A string value with the text to be included in the popup showed when the user taps the marker.
  • Name of the variable: "mini.intent.extra.POPUP_TEXT"
  • Example:
    String value="You are here";
    Intent myIntent=new Intent();
    Intent.putExtra("mini.intent.extra. POPUPTEXT",value);
EXTRA_RADIUS
  • A double value with a radius from a particular point.
  • Name of the variable: "mini.intent.extra.RADIUS"
  • Example:
    double value="500";
    Intent myIntent=new Intent();
    Intent.putExtra("mini.intent.extra.RADIUS",value);
EXTRA_RETURNED_ACCURACY
  • A double value with the accuracy with the real location of the user.
  • Name of the variable: "mini.intent.extra.RETURNED_ACCURACY"
  • Example:
    Intent obtained=getIntent();
    Double accuracy=obtained.getDoubleExtra("mini.intent.extra.RETURNED_ACCURACY",0);
EXTRA_RETURNED_ACCURACY_COLLECTION
  • An array of doubles with the accuracy of the locations taken from the user.
  • Name of the variable: "mini.intent.extra.RETURNED_ACCURACY_COLLECTION"
  • Example:
    Intent obtained=getIntent();
    Double []accuracyCollection=obtained. obtained.getDoubleArrayExtra ("mini.intent.extra.RETURNED_ACCURACY_COLLECTION");
EXTRA_RETURNED_ALTITUDE
  • A double value with the altitude of the user.
  • Name of the variable: "mini.intent.extra.RETURNED_ALTITUDE"
  • Example:
    Intent obtained=getIntent();
    Double altitude=obtained.getDoubleExtra("mini.intent.extra.RETURNED_ALTITUDE",0);
EXTRA_RETURNED_ALTITUDE_COLLECTION
  • An array of doubles with the altitudes of the locations taken from the user.
  • Name of the variable: "mini.intent.extra.RETURNED_ALTITUDE_COLLECTION"
  • Example:
    Intent obtained=getIntent();
    Double []altitudeCollection= obtained.getDoubleArrayExtra ("mini.intent.extra.RETURNED_ALTITUDE_COLLECTION");
EXTRA_RETURNED_DISTANCE
  • A double value with the distance between two points.
  • Name of the variable: "mini.intent.extra.EXTRA_DISTANCE"
  • Example:
    double value=getDistance();
    Intent myIntent=new Intent();
    Intent.putExtra("mini.intent.extra.EXTRA_DISTANCE",value);
EXTRA_RETURNED_FILE_PATH
  • A string value with a path of a file.
  • Name of the variable: "mini.intent.extra.RETURNED_FILE_PATH"
  • Example:
    Intent obtained=getIntent();
    String myLatitude=obtained.getStringExtra("mini.intent.extra.RETURNED_FILE_PATH");
EXTRA_RETURNED_LATITUDE
  • A double value with a latitude coordinate.
  • Name of the variable: "mini.intent.extra.RETURNED_LATITUDE"
  • Example of retrieving the variable:
    Intent obtained=getIntent();
    double myLatitude=obtained.getDoubleExtra("mini.intent.extra.RETURNED_LATITUDE",0);
EXTRA_RETURNED_LATITUDE_COLLECTION
  • An array of doubles that contains latitudes of different user's location.
  • Name of the variable: "mini.intent.extra.RETURNED_LATITUDE_COLLECTION"
  • Example of retrieving the variable:
    Intent obtained=getIntent();
    double []myLatitudes=obtained.getDoubleArrayExtra("mini.intent.extra.RETURNED_LATITUDE_COLLECTION");
EXTRA_RETURNED_LONGITUDE
  • A double value with a latitude coordinate.
  • Name of the variable: "mini.intent.extra.RETURNED_LONGITUDE"
  • Example of retrieving the variable:
    Intent obtained=getIntent();
    double myLongitude=obtained.getDoubleExtra("mini.intent.extra.RETURNED_LONGITUDE",0);
EXTRA_RETURNED_LONGITUDE_COLLECTION
  • An array of doubles that contains longitudese of different user's location.
  • Name of the variable: "mini.intent.extra.RETURNED_LONGITUDE_COLLECTION"
  • Example of retrieving the variable:
    Intent obtained=getIntent();
    double []myLongitudes=obtained.getDoubleArrayExtra("mini.intent.extra.RETURNED_LONGITUDE_COLLECTION");
EXTRA_RETURNED_PLACE_NAME
  • A string value with the name of a place.
  • Name of the variable: "mini.intent.extra.RETURNED_PLACE_NAME"
  • Example of retrieving the variable:
    Intent obtained=getIntent();
    String placename=obtained.getStringExtra("mini.intent.extra.RETURNED_PLACE_NAME");
EXTRA_RETURNED_PROVIDER_TYPE
  • A string value with the name of the provider of the location.
  • Name of the variable: "mini.intent.extra.RETURNED_PROVIDER_TYPE"
  • Example of retrieving the variable:
    Intent obtained=getIntent();
    String locationProvider=obtained.getStringExtra("mini.intent.extra.RETURNED_PROVIDER_TYPE");
EXTRA_RETURNED_SERVICE_NAME
  • A string value with the name of the service that provides a name of a place.
  • Name of the variable: "mini.intent.extra.RETURNED_SERVICE_NAME"
  • Example of retrieving the variable:
    Intent obtained=getIntent();
    String PlaceProviderName=obtained.getStringExtra("mini.intent.extra.RETURNED_SERVICE_NAME");
EXTRA_RETURNED_TIME_COLLECTION
  • An array of strings that contains the different times in which the user's location is taken.
  • Name of the variable: "mini.intent.extra.RETURNED_TIME_COLLECTION"
  • Example of retrieving the variable:
    Intent obtained=getIntent();
    String []myTimeCollection=obtained.getStringExtra("mini.intent.extra.RETURNED_TIME_COLLECTION");
EXTRA_SERVICE_NAME
  • A string value with the name of the service that provides a name of a place.
  • Name of the variable: "mini.intent.extra.SERVICE_NAME"
  • Example:
    String value="Name of the place provider";
    Intent myIntent=new Intent();
    Intent.putExtra("mini.intent.extra. SERVICE_NAME",value);
EXTRA_SHORTEST_ROUTE
  • A boolean value that allows developers to specify if they want to get the shortest route between two points.
  • Name of the variable: "mini.intent.extra.SHORTEST_ROUTE"
  • Example:
    boolean value=true;
    Intent myIntent=new Intent();
    Intent.putExtra("mini.intent.extra.SHORTEST_ROUTE",value);
EXTRA_START_LATITUDE
  • A double value with a latitude coordinate.
  • Name of the variable: "mini.intent.extra.START_LATITUDE"
  • Example:
    double value=39.5;
    Intent myIntent=new Intent();
    Intent.putExtra("mini.intent.extra.START_LATITUDE",value);
EXTRA_START_LONGITUDE
  • A double value with a longitude coordinate.
  • Name of the variable: "mini.intent.extra.START_LONGITUDE"
  • Example:
    double value=2.3;
    Intent myIntent=new Intent();
    Intent.putExtra("mini.intent.extra.START_LONGITUDE",value);
EXTRA_STRAIGHT_LINE_DISTANCE
  • A boolean value that allows developers to specify if they want to get the distance of the straight line between two points.
  • Name of the variable: "mini.intent.extra.STRAIGHT_LINE_DISTANCE"
  • Example:
    boolean value=true;
    Intent myIntent=new Intent();
    Intent.putExtra("mini.intent.extra. STRAIGHT_LINE_DISTANCE",value);
EXTRA_TRACKING_DURATION
  • A int value with the number of minutes that gvSIG Mini has to do the user's tracking.
  • Name of the variable: "mini.intent.extra.TRACKING_DURATION"
  • Example:
    int value="60";
    Intent myIntent=new Intent();
    Intent.putExtra("mini.intent.extra.TRACKING_DURATION",value);
EXTRA_TYPE_OF_GEOMETRY
  • A string value with the name of the type of the geometries that are going to be drawn.
  • Name of the variable: "mini.intent.extra.TYPE_OF_GEOMETRY"
  • Example:
    String value="line";
    Intent myIntent=new Intent();
    Intent.putExtra("mini.intent.extra.TYPE_OF_GEOMETRY",value);
EXTRA_USER_ICON
  • A string value with the path of a .PNG. This .PNG that is located in the SD Card and symbolizes the user.
  • Name of the variable: "mini.intent.extra.USER_ICON"
  • Example:
    String value=Environment.getExternalStorageDirectory().toString()+"myapp/usericon.png";
    Intent myIntent=new Intent();
    Intent.putExtra("mini.intent.extra.USER_ICON",value);
  • A string value with the location of the WMS Server
  • Name of the variable: "mini.intent.extra.WMS_SERVER_LINK"
  • Example:
    String value="http://www.cartociudad.es/wms/CA..../CARTOCIUDAD?Request=GetCapabilities&Service=WMS";
    Intent myIntent=new Intent();
    Intent.putExtra("mini.intent.extra. WMS_SERVER_LINK",value);
EXTRA_ZOOM_LEVEL
  • An int value, between 0 and 18, that represents the map zoomlevel.
  • Name of the variable: "mini.intent.extra.ZOOM_LEVEL"
  • Example:
    Int value=7;
    Intent myIntent=new Intent();
    Intent.putExtra("mini.intent.extra.ZOOM_LEVEL",value);

Services

Broadcast actions