Number of Features in a Table

Description

Returns the number of features within a named table. This method can also use a search at point query parameter to return the number of features at a given point, using a distance tolerance around the point. Here are some basic rules for the searchAtPoint method when returning feature count:

  • The q attribute must be the query type searchAtPoint.
  • The default tolerance radius is 300 meters.
Note: When using count without the q parameter, the record count is obtained from the TAB file header and is fast regardless of the table size. However, when used on an un-packed TAB file, the record count includes deleted records. To fix this, either pack the TAB file in MapInfo Pro or use the Search for Features Using SQL Queries REST method with count*. The latter approach will be slower for large tables (with millions of records).

ACL Authorization Flow

To list the number of features within a named table, 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/count&q=searchAtPoint&point=point,srs
&[tolerance=distance unit]&destinationSrs
&[geometryAttributeName=geomname]

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 feature 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 feature metadata for a named table located at /Samples/NamedTables/WorldTable in the Repository, the following URL would be used:
.../FeatureService/tables/Samples/​NamedTables
/WorldTable/features/count;...
q=searchAtPoint String no The query method to perform. This must be searchAtPoint.
point=point,srs String no 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.

Returns

Returns metadata for a named table in the repository.

Examples

Returns the total number of features that are in the WorldTable.

http://<hostname>:<port>/rest/Spatial/FeatureService/tables/Samples/NamedTables/WorldTable/features/count

Returns the total number of features from the WorldTable that are within 1000 miles from the specified point.

http://<hostname>:<port>/rest/Spatial/FeatureService/tables/Samples/NamedTables/WorldTable/features/count?
q=searchAtPoint&point=-75.651157,45.374245,EPSG:4326&tolerance=1000%20mi