QuickFeatures® API 1.0 Basics
The features API enables access to your data stored within the MapData Services’ spatial databases.
To get started using this API, you will first need credentials and then follow these steps for referencing the API within your JavaScript.
<script type="text/javascript" src="http://apps.nowwhere.com.au/MDSQuickMap/FeaturesControl.ashx?key=YOUR_API_KEY_HERE"></script>
MapDS.Features.ServiceClient
This is the central class of the Features API. It enables access to the feature types available and the features of each type.
It obtains the API Key from the server control when the API is served to the client. To obtain public datasets that do not require an API key, set the key to null.
Methods
| Method |
Return Type |
Description |
| getEncoded() |
Boolean |
Retrieves the encoded value. |
| setEncoded(encoded: Boolean) |
None |
Sets the encoded flag. Default is true.
When set to true, the getFeatures method will use the google polyline encoding algorithm to encode coordinate data between client and server. If you are using the QuickMap v3 API, Both Polyline & Polygon objects can decode the response. Does not encode single points. |
| getFeature(type: string, id: string, callback: Function) |
None |
Retrieves a single feature of specified type. |
| getFeatures(options: (FeatureQuery, BBOXQuery|FromFeatureQuery|PointsQuery), type: string, callback: Function) |
None |
Retrieves features using options as your search criteria, operating on specified feature type. Default is 'all' and will retrieve features from all types available to specified API key. |
| getFeatureType(type: String, callback: Function) |
None |
Retrieves a specified feature type. |
| getFeatureTypes(callback: Function) |
None |
Retrieves all feature types the key has access to. |
| getFormat() |
String |
Retrieves the response format. |
| setFormat(format: String) |
None |
Sets the response format used for getFeature, getFeatureType & getFeatureTypes requests. Default is json. Supported formats: json (as GeoJSON), To be supported soon: xml, rss, atom. |
| getKey() |
Number |
Retrieves the API Key used for feature requests. |
| setKey(key: String) |
None |
Sets the API key. |
MapDS.Features.BBOXQuery
Contains values required to issue a bounding box query to the features service.
Constructor
|
Constructor
|
Description
|
| BBOXQuery(bbox: Bounds, [options]) |
Creates a new BBOXQuery object.
|
Methods
| Method |
Return Type |
Description |
| getBBOX() |
Bounds |
Retrieves a Bounds object containing the extents of the bounding box. |
| setBBOX(bbox: Bounds) |
None |
Sets the bounding box. |
MapDS.Features.FromFeatureQuery
Enables you to specify a feature & buffer to start your spatial search from and find all features that intersect.
Constructor
| Constructor |
Description |
| FromFeature(fromFeature: String, [options]) |
Creates a new FromFeatureQuery object. |
Methods
| Method |
Return Type |
Description |
| getBuffer() |
Integer |
Retrieves the buffer value. |
| setBuffer(buffer: String) |
None |
Sets the buffer in metres to apply to the specified feature. |
| getFromFeature() |
String |
Returns the set Feature Id |
| setFromFeature(fromFeature: String) |
None |
Sets a Feature Id, which can be from a different feature type than the query feature type. |
MapDS.Features.PointsQuery
Enables a query to retrieve features around a single point or a connected series of points (polyline).
Constructor
| Constructor |
Description |
| PointsQuery(points: Array(LatLng) [, options]) |
Creates a new PointsQuery object. |
Methods
| Method |
Return Type |
Description |
| getBuffer() |
Integer |
Retrieves the buffer value. |
| setBuffer(buffer: Integer) |
None |
Sets the buffer in metres. |
| getPoints() |
Array |
Array of LatLng points |
This class enables you to set basic options for query that has no spatial properties. This class is the base class for the spatial classes: BBOXQuery, FromFeatureQuery and PointsQuery.
Constructor
| Constructor |
Description |
| FeatureQuery([options]) |
Creates a new FeatureQuery object. |
Properties
| Property |
Description |
| filter |
An optional filter criteria. Filter syntax. |
| items |
Number of items for query to return. |
| page |
Page number of items to return. Default is 1. |
| sortby |
Feature fieldname to sort features by. You can also sort results by distance when using a PointsQuery. |
| sortorder |
Ordering of feature items returned. Values are asc or desc. Default is asc. |