Search a Table for Features at a Point

Description

Searches a named table within the repository for features that are at a specified point, within a certain tolerance. You have the options of returning all of the attribute data, specific attribute data, and ordering the returned data by an attribute. Here are some basic rules for the searchAtPoint method:

  • Returns a feature collection plus the attributes.
  • Returns the distance in the unit specified in the tolerance.
  • Returns results, by default, closest to farthest
  • The q attribute must be the query type searchAtPoint.
  • When specifying attribute and orderBy Matrix parameters you can list more than one using a comma separated list.
  • The default tolerance radius is 300 meters.
  • When using the orderBy matrix parameter you must specify the sort direction as either D for descending or A for ascending.

This operation returns a feature collection JSON that can be passed to a render map or render legend request in the Mapping service.

ACL Authorization Flow

To search a named table within the repository for features that are at a specified point, the user (or the role they belong to) needs EXECUTE permission on the Named table.

HTTP GET URL Format

The following format is used for HTTP GET requests:

HTTP GET /tables/tablename/features.rep;[attributes=attname];[orderBy=attname dir]
&q=searchAtPoint&point=point,srs&[tolerance=distance unit]
&destinationSrs&[geometryAttributeName=geomname]
&[page=pagenumber]&[pageLength=pagelength]

Parameters

For information on the parameter types listed below, see Request URL Data Types.

Parameter Type Required Description
tablename String yes The name of the table to return metadata. The table is specified by a Regex for the named table to render based on the location of the named table in the Repository. The name of the named table is defined between the /tables portion of the URL and the /metadata.rep portion of the URL. For example, to return the metadata for a named table located at /Samples/NamedTables/WorldTable in the Repository, the following URL would be used:
.../FeatureService/tables/Samples/NamedTables
/WorldTable/metadata.json;...
rep String yes The representation to be returned. Supported representation is json.
attributes=attname String no The attribute names of the table to be returned in the response. By default all attributes are returned. More than one attribute is defined by a comma separated list. This is a simple way of limiting the amount of information in the response to include only the information requested. Each feature in the resulting feature collection will only contain the specified attributes. For example, if the table contains four attributes, but only two are required in the response, those two attribute names can be specified here (separated by a comma) and the values for the other two will not be returned.
orderBy=attname dir String no The attribute name and direction to order the returned results. By default the results are ordered from closest to farthest based on the distance from the specified point. When specifying an attribute to order the results, you must include both the attribute name and the ordering direction (A for ascending (low to high) or D for descending (high to low)).
q=searchAtPoint String yes The query method to perform. This must be searchAtPoint.
point=point,srs String yes The point used as the starting location for the search. The point must include the x/y positions and the spatial reference system for the geometry. For example: point=-75.651157,45.374245,EPSG:4326
tolerance=distance unit String no The distance to search around the point. By default the tolerance is 300 meters. When specified, the tolerance must include the distance value and distance unit. The distance values returned in the response will be in the units specified in the request (default is meters).
destinationSrs String no The coordinate system to return the resulting geometries. The default is the coordinate system of the data used (for example: epsg:4326).
geometryAttributeName=

geomname

String no The geometry definition attribute from the table that should be used for processing the spatial query. This attribute is only required for tables that contain more than one geometry attribute definition.
page=pagenumber String no The page number to return.
pageLength=

pagelength

String no The number of features returned on each page. If the page parameter is specified in the request, you must define pageLength.

Returns

Returns metadata for a named table in the repository.

Examples

Returns the world capitals that are within 1000 miles from the specified point. All attributes for features found in the WorldcapTable will be returned.

http://hostname:port/rest/Spatial/FeatureService/tables/Samples/NamedTables/WorldcapTable/
	features.json?q=searchAtPoint&point=-75.651157,45.374245,
	EPSG%3A4326&tolerance=1000%20mi

Returns the world capitals that are within 500 miles from the specified point. Only the Country and Cap_Pop attributes for features found in the WorldcapTable will be returned.

http://hostname:port/rest/Spatial/FeatureService/tables/Samples/NamedTables/WorldcapTable/
	features.json;attributes=Country,Cap_Pop?q=searchAtPoint&point=-75.651157,45.374245,
	EPSG%3A4326&tolerance=500%20miamp;destinationSrs=epsg:3857

Returns the world capitals that are within 500 miles from the specified point. Only the Country attribute will be returned, and order on the Country attribute in descending order, for features found in the WorldcapTable.

http://hostname:port/rest/Spatial/FeatureService/tables/Samples/NamedTables/WorldcapTable/features.json;
	attributes=Country;orderBy=Country%20D?q=searchAtPoint&point=-75.651157,45.374245,
	EPSG%3A4326&tolerance=500%20mi