This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
thinkgeo_cloud_javascript_client_apis [2019/07/17 02:41] kevinwan |
thinkgeo_cloud_javascript_client_apis [2019/07/17 03:26] (current) kevinwan [tg.MapsQueryClient] |
||
---|---|---|---|
Line 1076: | Line 1076: | ||
- | ===== tg.RoutingClient ===== | + | ===== tg.MapsQueryClient ===== |
- | Coming soon. | + | <div cloud_client_description> A class provides the methods to access the Maps Query APIs. Perform spatial query against each types of data.</div> |
+ | |||
+ | |||
+ | <div cloud_client_synta> Syntax </div> | ||
+ | |||
+ | <code javascript> | ||
+ | var mapsQueryClient = new tg.MapsQueryClient ('Your-Cloud-Service-Api-Key'); | ||
+ | </code> | ||
+ | <div cloud_client_parameter> Parameters </div> | ||
+ | <div cloud_client_table> | ||
+ | ^Name ^Type ^Description ^ | ||
+ | |<span cloud_client_name>apiKey</span> |string | An API key for access to ThinkGeo Cloud services, it can be created following the [[http://wiki.thinkgeo.com/wiki/thinkgeo_cloud_quick_start_guide|guide]] | | ||
+ | </div> | ||
+ | |||
+ | <div cloud_client_synta> Return Value </div> | ||
+ | <div cloud_client_description>a Maps Query object to access the Maps Query APIs in ThinkGeo Cloud service.</div> | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | <div cloud_client_method> mapsQueryClient.getFeaturesWithin(queryLayer, wkt, callback, options) </div> | ||
+ | <div cloud_client_description>Get the features that are within the target shape.</div> | ||
+ | <div cloud_client_synta> Syntax </div> | ||
+ | <code javascript> | ||
+ | var queryLayer = 'countries'; | ||
+ | var wkt = 'POLYGON((15.609372854233 56.62500500679, 1.8984353542334 42.56250500679, 30.023435354233 41.15625500679, 15.609372854233 56.62500500679))'; | ||
+ | var options = { | ||
+ | srid: 4326, | ||
+ | maxResults: 100, | ||
+ | returnFeatureAttributes: true, | ||
+ | featureAttributesToReturn: ['id', 'name'] | ||
+ | }; | ||
+ | var callback = function (status, response) { | ||
+ | console.log(response); | ||
+ | }; | ||
+ | mapsQueryClient.getFeaturesWithin(queryLayer, wkt, callback, options); | ||
+ | </code> | ||
+ | |||
+ | <div cloud_client_parameter> Parameters </div> | ||
+ | <div cloud_client_table> | ||
+ | ^Name ^Type ^ ^ ^Description ^ | ||
+ | |<span cloud_client_name>queryLayer</span> |string | | |The query layer. | | ||
+ | |<span cloud_client_name>wkt</span> |string | | |The well-known text of target shape. | | ||
+ | |<span cloud_client_name>callback</span> |function | | |the callback for response. | | ||
+ | |<span cloud_client_name>options</span> |Options | | | | ||
+ | | ^Name ^Type ^Default ^Description ^ | ||
+ | | |<span cloud_client_name>srid</span> |integer | |The SRID (coordinate system ID) in which to input and output the result. Mutually exclusive from the Proj4String parameter. | | ||
+ | | |<span cloud_client_name>proj4String</span> |string |"+proj=longlat +datum=WGS84 +no_defs" |The Proj4 projection string (coordinate system) in which to input and output the result. Mutually exclusive from the Srid parameter. Defaults to “+proj=longlat +datum=WGS84 +no_defs”. | | ||
+ | | |<span cloud_client_name>maxResults</span> |integer |100 |The maximum number of features to return. | | ||
+ | | |<span cloud_client_name>returnFeatureAttributes</span> |boolean |true |If true, specifies that the feature attribute column names and values will be returned in the response. | | ||
+ | | |<span cloud_client_name>featureAttributesToReturn</span> |array | |If <span cloud_client_name>returnFeatureAttributes</span> is true, this allows the user to specify which a specific subset of attributes to be returned. | | ||
+ | </div> | ||
+ | |||
+ | |||
+ | <div cloud_client_method> mapsQueryClient.getFeaturesContaining(queryLayer, wkt, callback, options) </div> | ||
+ | <div cloud_client_description>Get the features that contain the target shape.</div> | ||
+ | <div cloud_client_synta> Syntax </div> | ||
+ | <code javascript> | ||
+ | var queryLayer = 'countries'; | ||
+ | var wkt = 'POINT(-95.484377145767 36.93750500679)'; | ||
+ | var options = { | ||
+ | srid: 4326, | ||
+ | maxResults: 100, | ||
+ | returnFeatureAttributes: true, | ||
+ | featureAttributesToReturn: ['id', 'name'] | ||
+ | }; | ||
+ | var callback = function (status, response) { | ||
+ | console.log(response); | ||
+ | }; | ||
+ | mapsQueryClient.getFeaturesContaining(queryLayer, wkt, callback, options); | ||
+ | </code> | ||
+ | |||
+ | <div cloud_client_parameter> Parameters </div> | ||
+ | <div cloud_client_table> | ||
+ | ^Name ^Type ^ ^ ^Description ^ | ||
+ | |<span cloud_client_name>queryLayer</span> |string | | |The query layer. | | ||
+ | |<span cloud_client_name>wkt</span> |string | | |The well-known text of target shape. | | ||
+ | |<span cloud_client_name>callback</span> |function | | |the callback for response. | | ||
+ | |<span cloud_client_name>options</span> |Options | | | | ||
+ | | ^Name ^Type ^Default ^Description ^ | ||
+ | | |<span cloud_client_name>srid</span> |integer | |The SRID (coordinate system ID) in which to input and output the result. Mutually exclusive from the Proj4String parameter. | | ||
+ | | |<span cloud_client_name>proj4String</span> |string |"+proj=longlat +datum=WGS84 +no_defs" |The Proj4 projection string (coordinate system) in which to input and output the result. Mutually exclusive from the Srid parameter. Defaults to “+proj=longlat +datum=WGS84 +no_defs”. | | ||
+ | | |<span cloud_client_name>maxResults</span> |integer |100 |The maximum number of features to return. | | ||
+ | | |<span cloud_client_name>returnFeatureAttributes</span> |boolean |true |If true, specifies that the feature attribute column names and values will be returned in the response. | | ||
+ | | |<span cloud_client_name>featureAttributesToReturn</span> |array | |If <span cloud_client_name>returnFeatureAttributes</span> is true, this allows the user to specify which a specific subset of attributes to be returned. | | ||
+ | </div> | ||
+ | |||
+ | |||
+ | <div cloud_client_method> mapsQueryClient.getFeaturesIntersecting(queryLayer, wkt, callback, options) </div> | ||
+ | <div cloud_client_description>Get the features that intersect the target shape.</div> | ||
+ | <div cloud_client_synta> Syntax </div> | ||
+ | <code javascript> | ||
+ | var queryLayer = 'countries'; | ||
+ | var wkt = 'POLYGON((15.609372854233 56.62500500679, 1.8984353542334 42.56250500679, 30.023435354233 41.15625500679, 15.609372854233 56.62500500679))'; | ||
+ | var options = { | ||
+ | srid: 4326, | ||
+ | maxResults: 100, | ||
+ | returnFeatureAttributes: true, | ||
+ | featureAttributesToReturn: ['id', 'name'] | ||
+ | }; | ||
+ | var callback = function (status, response) { | ||
+ | console.log(response); | ||
+ | }; | ||
+ | mapsQueryClient.getFeaturesIntersecting(queryLayer, wkt, callback, options); | ||
+ | </code> | ||
+ | |||
+ | <div cloud_client_parameter> Parameters </div> | ||
+ | <div cloud_client_table> | ||
+ | ^Name ^Type ^ ^ ^Description ^ | ||
+ | |<span cloud_client_name>queryLayer</span> |string | | |The query layer. | | ||
+ | |<span cloud_client_name>wkt</span> |string | | |The well-known text of target shape. | | ||
+ | |<span cloud_client_name>callback</span> |function | | |the callback for response. | | ||
+ | |<span cloud_client_name>options</span> |Options | | | | ||
+ | | ^Name ^Type ^Default ^Description ^ | ||
+ | | |<span cloud_client_name>srid</span> |integer | |The SRID (coordinate system ID) in which to input and output the result. Mutually exclusive from the Proj4String parameter. | | ||
+ | | |<span cloud_client_name>proj4String</span> |string |"+proj=longlat +datum=WGS84 +no_defs" |The Proj4 projection string (coordinate system) in which to input and output the result. Mutually exclusive from the Srid parameter. Defaults to “+proj=longlat +datum=WGS84 +no_defs”. | | ||
+ | | |<span cloud_client_name>maxResults</span> |integer |100 |The maximum number of features to return. | | ||
+ | | |<span cloud_client_name>returnFeatureAttributes</span> |boolean |true |If true, specifies that the feature attribute column names and values will be returned in the response. | | ||
+ | | |<span cloud_client_name>featureAttributesToReturn</span> |array | |If <span cloud_client_name>returnFeatureAttributes</span> is true, this allows the user to specify which a specific subset of attributes to be returned. | | ||
+ | </div> | ||
+ | |||
+ | |||
+ | <div cloud_client_method> mapsQueryClient.getFeaturesOverlapping(queryLayer, wkt, callback, options) </div> | ||
+ | <div cloud_client_description>Get the features that overlap the target shape.</div> | ||
+ | <div cloud_client_synta> Syntax </div> | ||
+ | <code javascript> | ||
+ | var queryLayer = 'countries'; | ||
+ | var wkt = 'POLYGON((15.609372854233 56.62500500679, 1.8984353542334 42.56250500679, 30.023435354233 41.15625500679, 15.609372854233 56.62500500679))'; | ||
+ | var options = { | ||
+ | srid: 4326, | ||
+ | maxResults: 100, | ||
+ | returnFeatureAttributes: true, | ||
+ | featureAttributesToReturn: ['id', 'name'] | ||
+ | }; | ||
+ | var callback = function (status, response) { | ||
+ | console.log(response); | ||
+ | }; | ||
+ | mapsQueryClient.getFeaturesOverlapping(queryLayer, wkt, callback, options); | ||
+ | </code> | ||
+ | |||
+ | <div cloud_client_parameter> Parameters </div> | ||
+ | <div cloud_client_table> | ||
+ | ^Name ^Type ^ ^ ^Description ^ | ||
+ | |<span cloud_client_name>queryLayer</span> |string | | |The query layer. | | ||
+ | |<span cloud_client_name>wkt</span> |string | | |The well-known text of target shape. | | ||
+ | |<span cloud_client_name>callback</span> |function | | |the callback for response. | | ||
+ | |<span cloud_client_name>options</span> |Options | | | | ||
+ | | ^Name ^Type ^Default ^Description ^ | ||
+ | | |<span cloud_client_name>srid</span> |integer | |The SRID (coordinate system ID) in which to input and output the result. Mutually exclusive from the Proj4String parameter. | | ||
+ | | |<span cloud_client_name>proj4String</span> |string |"+proj=longlat +datum=WGS84 +no_defs" |The Proj4 projection string (coordinate system) in which to input and output the result. Mutually exclusive from the Srid parameter. Defaults to “+proj=longlat +datum=WGS84 +no_defs”. | | ||
+ | | |<span cloud_client_name>maxResults</span> |integer |100 |The maximum number of features to return. | | ||
+ | | |<span cloud_client_name>returnFeatureAttributes</span> |boolean |true |If true, specifies that the feature attribute column names and values will be returned in the response. | | ||
+ | | |<span cloud_client_name>featureAttributesToReturn</span> |array | |If <span cloud_client_name>returnFeatureAttributes</span> is true, this allows the user to specify which a specific subset of attributes to be returned. | | ||
+ | </div> | ||
+ | |||
+ | |||
+ | <div cloud_client_method> mapsQueryClient.getFeaturesTouching(queryLayer, wkt, callback, options) </div> | ||
+ | <div cloud_client_description>Get the features that touch the target shape.</div> | ||
+ | <div cloud_client_synta> Syntax </div> | ||
+ | <code javascript> | ||
+ | var queryLayer = 'countries'; | ||
+ | var wkt = 'POLYGON((7595881.1058614058 -585345.10944436956,7595881.1058614058 2704373.8120167661,-3939883.7747361474 2704373.8120167661,-3939883.7747361474 -585345.10944436956,7595881.1058614058 -585345.10944436956))'; | ||
+ | var options = { | ||
+ | srid: 3857, | ||
+ | maxResults: 100, | ||
+ | returnFeatureAttributes: true, | ||
+ | featureAttributesToReturn: ['id', 'name'] | ||
+ | }; | ||
+ | var callback = function (status, response) { | ||
+ | console.log(response); | ||
+ | }; | ||
+ | mapsQueryClient.getFeaturesTouching(queryLayer, wkt, callback, options); | ||
+ | </code> | ||
+ | |||
+ | <div cloud_client_parameter> Parameters </div> | ||
+ | <div cloud_client_table> | ||
+ | ^Name ^Type ^ ^ ^Description ^ | ||
+ | |<span cloud_client_name>queryLayer</span> |string | | |The query layer. | | ||
+ | |<span cloud_client_name>wkt</span> |string | | |The well-known text of target shape. | | ||
+ | |<span cloud_client_name>callback</span> |function | | |the callback for response. | | ||
+ | |<span cloud_client_name>options</span> |Options | | | | ||
+ | | ^Name ^Type ^Default ^Description ^ | ||
+ | | |<span cloud_client_name>srid</span> |integer | |The SRID (coordinate system ID) in which to input and output the result. Mutually exclusive from the Proj4String parameter. | | ||
+ | | |<span cloud_client_name>proj4String</span> |string |"+proj=longlat +datum=WGS84 +no_defs" |The Proj4 projection string (coordinate system) in which to input and output the result. Mutually exclusive from the Srid parameter. Defaults to “+proj=longlat +datum=WGS84 +no_defs”. | | ||
+ | | |<span cloud_client_name>maxResults</span> |integer |100 |The maximum number of features to return. | | ||
+ | | |<span cloud_client_name>returnFeatureAttributes</span> |boolean |true |If true, specifies that the feature attribute column names and values will be returned in the response. | | ||
+ | | |<span cloud_client_name>featureAttributesToReturn</span> |array | |If <span cloud_client_name>returnFeatureAttributes</span> is true, this allows the user to specify which a specific subset of attributes to be returned. | | ||
+ | </div> | ||
+ | |||
+ | |||
+ | <div cloud_client_method> mapsQueryClient.getFeaturesNearest(queryLayer, wkt, callback, options) </div> | ||
+ | <div cloud_client_description>Get the features that are nearest to the target shape.</div> | ||
+ | <div cloud_client_synta> Syntax </div> | ||
+ | <code javascript> | ||
+ | var queryLayer = 'countries'; | ||
+ | var wkt = 'POINT(17.367185354233 47.83594250679)'; | ||
+ | var options = { | ||
+ | srid: 4326, | ||
+ | maxResults: 100, | ||
+ | searchRadius: 200, | ||
+ | searchRadiusUnit: 'Kilometer', | ||
+ | returnFeatureAttributes: true, | ||
+ | featureAttributesToReturn: ['id', 'name'] | ||
+ | }; | ||
+ | var callback = function (status, response) { | ||
+ | console.log(response); | ||
+ | }; | ||
+ | mapsQueryClient.getFeaturesNearest(queryLayer, wkt, callback, options); | ||
+ | </code> | ||
+ | |||
+ | <div cloud_client_parameter> Parameters </div> | ||
+ | <div cloud_client_table> | ||
+ | ^Name ^Type ^ ^ ^Description ^ | ||
+ | |<span cloud_client_name>queryLayer</span> |string | | |The query layer. | | ||
+ | |<span cloud_client_name>wkt</span> |string | | |The well-known text of target shape. | | ||
+ | |<span cloud_client_name>callback</span> |function | | |the callback for response. | | ||
+ | |<span cloud_client_name>options</span> |Options | | | | ||
+ | | ^Name ^Type ^Default ^Description ^ | ||
+ | | |<span cloud_client_name>srid</span> |integer | |The SRID (coordinate system ID) in which to input and output the result. Mutually exclusive from the Proj4String parameter. | | ||
+ | | |<span cloud_client_name>proj4String</span> |string |"+proj=longlat +datum=WGS84 +no_defs" |The Proj4 projection string (coordinate system) in which to input and output the result. Mutually exclusive from the Srid parameter. Defaults to “+proj=longlat +datum=WGS84 +no_defs”. | | ||
+ | | |<span cloud_client_name>searchRadius</span> |double | |The radius of the search area around the target geometry. If not specified, it's assumed that there is no limit. | | ||
+ | | |<span cloud_client_name>searchRadiusUnit</span> |string | |The unit of measure in which the <span cloud_client_name>searchRadius</span> is expressed. | | ||
+ | | |<span cloud_client_name>maxResults</span> |integer |100 |The maximum number of features to return. | | ||
+ | | |<span cloud_client_name>returnFeatureAttributes</span> |boolean |true |If true, specifies that the feature attribute column names and values will be returned in the response. | | ||
+ | | |<span cloud_client_name>featureAttributesToReturn</span> |array | |If <span cloud_client_name>returnFeatureAttributes</span> is true, this allows the user to specify which a specific subset of attributes to be returned. | | ||
+ | </div> | ||
+ | |||
+ | |||
+ | <div cloud_client_method> mapsQueryClient.getFeaturesWithinDistance(queryLayer, wkt, callback, options) </div> | ||
+ | <div cloud_client_description>Get the features that are within a certain distance of the target shape.</div> | ||
+ | <div cloud_client_synta> Syntax </div> | ||
+ | <code javascript> | ||
+ | var queryLayer = 'countries'; | ||
+ | var wkt = 'POINT(17.367185354233 47.83594250679)'; | ||
+ | var options = { | ||
+ | srid: 4326, | ||
+ | maxResults: 100, | ||
+ | distance: 200, | ||
+ | distanceUnit: 'Kilometer', | ||
+ | returnFeatureAttributes: true, | ||
+ | featureAttributesToReturn: ['id', 'name'] | ||
+ | }; | ||
+ | var callback = function (status, response) { | ||
+ | console.log(response); | ||
+ | }; | ||
+ | mapsQueryClient.getFeaturesWithinDistance(queryLayer, wkt, callback, options); | ||
+ | </code> | ||
+ | |||
+ | <div cloud_client_parameter> Parameters </div> | ||
+ | <div cloud_client_table> | ||
+ | ^Name ^Type ^ ^ ^Description ^ | ||
+ | |<span cloud_client_name>queryLayer</span> |string | | |The query layer. | | ||
+ | |<span cloud_client_name>wkt</span> |string | | |The well-known text of target shape. | | ||
+ | |<span cloud_client_name>callback</span> |function | | |the callback for response. | | ||
+ | |<span cloud_client_name>options</span> |Options | | | | ||
+ | | ^Name ^Type ^Default ^Description ^ | ||
+ | | |<span cloud_client_name>srid</span> |integer | |The SRID (coordinate system ID) in which to input and output the result. Mutually exclusive from the Proj4String parameter. | | ||
+ | | |<span cloud_client_name>proj4String</span> |string |"+proj=longlat +datum=WGS84 +no_defs" |The Proj4 projection string (coordinate system) in which to input and output the result. Mutually exclusive from the Srid parameter. Defaults to “+proj=longlat +datum=WGS84 +no_defs”. | | ||
+ | | |<span cloud_client_name>distance</span> |double |200 |The distance within which to find features. | | ||
+ | | |<span cloud_client_name>distanceUnit</span> |string |"Meter" |The unit of measure in which the <span cloud_client_name>distance</span> is expressed. | | ||
+ | | |<span cloud_client_name>maxResults</span> |integer |100 |The maximum number of features to return. | | ||
+ | | |<span cloud_client_name>returnFeatureAttributes</span> |boolean |true |If true, specifies that the feature attribute column names and values will be returned in the response. | | ||
+ | | |<span cloud_client_name>featureAttributesToReturn</span> |array | |If <span cloud_client_name>returnFeatureAttributes</span> is true, this allows the user to specify which a specific subset of attributes to be returned. | | ||
+ | </div> | ||
+ | |||
+ | |||
+ | <div cloud_client_method> mapsQueryClient.getFeaturesCustom(queryLayer, wkt, callback, options) </div> | ||
+ | <div cloud_client_description>Perform a custom spatial query, using the specified query layer, spatial relationship type, and query feature.</div> | ||
+ | <div cloud_client_synta> Syntax </div> | ||
+ | <code javascript> | ||
+ | var queryLayer = 'countries'; | ||
+ | var wkt = 'POLYGON((15.609372854233 56.62500500679, 1.8984353542334 42.56250500679, 30.023435354233 41.15625500679, 15.609372854233 56.62500500679))'; | ||
+ | var options = { | ||
+ | srid: 4326, | ||
+ | maxResults: 100, | ||
+ | returnFeatureAttributes: true, | ||
+ | featureAttributesToReturn: ['id', 'name'] | ||
+ | }; | ||
+ | var callback = function (status, response) { | ||
+ | console.log(response); | ||
+ | }; | ||
+ | mapsQueryClient.getFeaturesCustom(queryLayer, wkt, 'within', callback, options); | ||
+ | </code> | ||
+ | |||
+ | <div cloud_client_parameter> Parameters </div> | ||
+ | <div cloud_client_table> | ||
+ | ^Name ^Type ^ ^ ^Description ^ | ||
+ | |<span cloud_client_name>queryLayer</span> |string | | |The query layer. | | ||
+ | |<span cloud_client_name>wkt</span> |string | | |The well-known text of target shape. | | ||
+ | |<span cloud_client_name>callback</span> |function | | |the callback for response. | | ||
+ | |<span cloud_client_name>options</span> |Options | | | | ||
+ | | ^Name ^Type ^Default ^Description ^ | ||
+ | | |<span cloud_client_name>srid</span> |integer | |The SRID (coordinate system ID) in which to input and output the result. Mutually exclusive from the Proj4String parameter. | | ||
+ | | |<span cloud_client_name>proj4String</span> |string |"+proj=longlat +datum=WGS84 +no_defs" |The Proj4 projection string (coordinate system) in which to input and output the result. Mutually exclusive from the Srid parameter. Defaults to “+proj=longlat +datum=WGS84 +no_defs”. | | ||
+ | | |<span cloud_client_name>distance</span> |double |200 |The distance within which to find features. | | ||
+ | | |<span cloud_client_name>distanceUnit</span> |string |"Meter" |The unit of measure in which the <span cloud_client_name>distance</span> is expressed. | | ||
+ | | |<span cloud_client_name>searchRadius</span> |double | |The radius of the search area around the target geometry. If not specified, it's assumed that there is no limit. | | ||
+ | | |<span cloud_client_name>searchRadiusUnit</span> |string | |The unit of measure in which the <span cloud_client_name>searchRadius</span> is expressed. | | ||
+ | | |<span cloud_client_name>maxResults</span> |integer |100 |The maximum number of features to return. | | ||
+ | | |<span cloud_client_name>returnFeatureAttributes</span> |boolean |true |If true, specifies that the feature attribute column names and values will be returned in the response. | | ||
+ | | |<span cloud_client_name>featureAttributesToReturn</span> |array | |If <span cloud_client_name>returnFeatureAttributes</span> is true, this allows the user to specify which a specific subset of attributes to be returned. | | ||
+ | </div> | ||