1. GeoQuery URL Interface: Basic

Simple query in HTML: vn4.cs.fiu.edu/cgi-bin/gnis.cgi?vid=nsfmod.edu&tfaction=arquerypincorp&Lat=25.54&Long=-80.36

XML/JSON/CSV Help: The Example of XML link below shows the required parameters and the location parameters (coordinates or address). Likewise, we provide data-feeds in CSV and Geo-JSON. You may add additional record selection parameters as follows:

The easy way: Go to an HTML link for a dataset, e.g. pincorp-html; interactively modify your query by clicking on blue words and symbols and/or using the Criteria tab; then create the corresponding XML link by using the criteria encoded in the resulting link and add "&filetype=.xml".

The mid-easy way: Go to an HTML link for a dataset, e.g. pincorp-html; uncollapse the "More Searchable Fields" tab at the bottom of the page; it will list all fields, with field definitions and most-frequent values; click on any field to see an example of a URL querying on that field; combine multiple field queries if needed; add "&filetype=.xml"

The non-interactive way: The first record of the XML output lists field IDs and definitions of all fields. You can add criteria in the form field_id=word to restrict the field to the given value (or words in a field containing several words). It is case insensitive. For fields containing numeric data, you can also use comparison operators greater-or-equal ≥ (%3E=) and less-or-equal ≤ (%3C=). To look for a keyword in any field rather than in a specific field, specify: anyfield=keyword.

2. GeoQuery URL Interface: Detail


2.1. Submitting GeoQueries

The GeoQuery URL Interface allows users to access datasets via URL's producing query results in HTML, XML, JSON, and CSV formats.

URL Query Format:

<PATH TO ACCESS SCRIPT>?<TF ACTION LIST><LOCATION PARAMETERS><OTHER PARAMETER>

Example: The GeoQuery URL below returns all of the objects in the dataset pincorp dataset upto the default number, within the the default radius, of the specified coordinates. Please note that the XML output shows distance of every record in meters. The HTML GUI translates this into meters/km/feet/miles depending on context; but the input parameter is always in miles.

HTML: http://vn4.cs.fiu.edu/cgi-bin/gnis.cgi?vid=nsfmod.edu&tfaction=arquerypincorp&Lat=25.54&Long=-80.36

XML: http://vn4.cs.fiu.edu/cgi-bin/gnis.cgi?vid=nsfmod.edu&tfaction=arquerypincorp&Lat=25.54&Long=-80.36&filetype=.xml

TFaction definitions and parameter definitions can be found in section 2.5 and 2.7. vid=nsfmod.edu identifies the user group nsfmod.edu


2.2. Defining a Location/Point Using Location Parameters

Locations can be defined using <LOCATION PARAMETERS> within a GeoQuery using any one of three ways.

1) Using the location's latitude and longitude coordinates. Example: http://vn4.cs.fiu.edu/cgi-bin/gnis.cgi?vid=nsfmod.edu&tfaction=arquerypincorp&Lat=25.54&Long=-80.36&filetype=.xml

2) Using the location's street address and zip code. Example: http://vn4.cs.fiu.edu/cgi-bin/gnis.cgi?vid=nsfmod.edu&tfaction=arquerypincorp&street=10700+SW+8th+street&zip=33174&filetype=.xml

3) Using the location's street address, city, and state. Example: http://vn4.cs.fiu.edu/cgi-bin/gnis.cgi?vid=nsfmod.edu&tfaction=arquerypincorp&street=10700+SW+8th+street&city=miami&state=fl&filetype=.xml


2.3. Query Results File Type

The GeoQuery URL Interface produces the following formats:

1)      HTML - An HTML page displaying query results and an interactive TF map interface*

http://vn4.cs.fiu.edu/cgi-bin/gnis.cgi?vid=nsfmod.edu&tfaction=arquerypincorp&Lat=25.54&Long=-80.36&filetype

2)      XML - A standard XML file displaying query results

http://vn4.cs.fiu.edu/cgi-bin/gnis.cgi?vid=nsfmod.edu&tfaction=arquerypincorp&Lat=25.54&Long=-80.36&filetype=.xml

3)      JSON - A standard Geo-JSON file displaying query results

http://vn4.cs.fiu.edu/cgi-bin/gnis.cgi?vid=nsfmod.edu&tfaction=arquerypincorp&Lat=25.54&Long=-80.36&filetype=.json

3)      CSV - A standard CSV file displaying query results

http://vn4.cs.fiu.edu/cgi-bin/gnis.cgi?vid=nsfmod.edu&tfaction=arquerypincorp&Lat=25.54&Long=-80.36&filetype=.csv

*Note: In order to receive query results in HTML format, filetype must be left blank or the parameter must be omitted altogether.


2.4. Selecting a Dataset

There are various datasets available. Users can select a dataset using the "tfaction" or "category" parameters.

tfaction=arquery<DATASET NAME>

Example: tfaction=arquerypincorp for the dataset "pincorp" ("pincorp" means "Demographics of U.S. towns and incorporated areas represented as central points, as opposed to polygons")

Note: In the GeoQuery interface "arquery.cgi" a dataset is called a "category" and is specified as "category=pincorp". The User is separately provided with a list of datasets that the User has access to and examples of URLs for each of the accessible datasets (categories).


2.5. Report Width Specification

TF actions are special parameters that allow users to specify the dataset to be displayed as well as modify the way in which it is displayed. Table 1 present a list of values allowed as TF actions.

tfaction=<REPORT WIDTH MODIFIER>

Example: vn4.cs.fiu.edu/cgi-bin/gnis.cgi?vid=nsfmod.edu&tfaction=arquerypincorp&tfaction=tabview&Lat=25.54&Long=-80.36

Table 1 - Report widths

Display Modifiers

 

tabview

displays the same fields as "shortdisplay" but html results are forced to be tabular*

 

shortdisplay

displays only the main fields of the record**

 

longdisplay

displays most of the fields of the record**

*For many datasets, tabular is the default and/or mandatory presentation.

Thus, “tabview” is not relevant for XML results.

**shortdisplay and longdisplay will yield the same results for some datasets


2.6. Field Operators <OP>

The general query pattern for field operators is as follows:

<SCRIPT URL><TF ACTIONS><LOCATION PARAMETERS>arcriteria=1&<Field Name><OP><value>&<Field Name 2><OP><value><Field Name N><OP><value>

Example:

Returns incorporated places whose name contains Pensacola OR Gulf AND whose median residents age is less than 35:

http://vn4.cs.fiu.edu/cgi-bin/gnis.cgi?vid=nsfmod.edu&tfaction=arquerypincorp&tfaction=longdisplay&Lat=25.54&Long=-80.36&filetype=.xml&arcriteria=1&sname|=Pensacola+Gulf&sf1P013001<35

Where:

arcriteria=1& - is a separator between generic parameters (TF Actions, Location Parameters, script location) and dataset-specific criteria referencing the dataset's fields

<Field Name> - is the short name of a dataset field or is the pseudo-field “anyfield”, which represents the concatenation of all fields in the dataset. Field name in all criteria is the short name of a field of the dataset. The short names of the fields are listed in each record of the XML query result, provided the field's value is not null in the record. To see all queryable fields of the dataset: perform any HTML query, scroll to the bottom, see the list of long names of all the fields, click on any to obtain a query formatted with the short name. Example of the list: http://vn4.cs.fiu.edu/cgi-bin/gnis.cgi?vid=nsfmod.edu&tfaction=arquerypincorp&Lat=25.771261&Long=-80.195385#morecriteria

<OP> - is an operator from the table below

<value> - any alphanumeric string. Searches are case-insensitive.

Table 2 - Available Field Operators

Operator

Function

=

Equality

 

The field contains all of the word(s)

 

Example:

1) cityName=Key+Biscayne -- must contain both the word "Key" and the word "Biscayne" within the cityName field.

2) anyfield=Key+Biscayne -- must contain both the word "Key" and the word "Biscayne" independently in any field of the record.

|=

Disjunction

 

The field contains at least one of the word(s)

 

Example:

cityName|=Miami+Chicago+Detroit

Returns true for any cityName that contains Miami, Chicago, or Detroit.

!=

Negation -does not contain the word

>=

Greater than or equal*

<=

Less than or equal *

> 

Greater than*

< 

Less than*

 

 

*do not work with anyfield queries

Logic for inequality operators:

If both operands are numerals, the comparison is numeric; otherwise the comparison is lexicographic case-insensitive; ""<9<A=a

Example:

Returns incorporated places with populations less than or equal to 60,000: http://vn4.cs.fiu.edu/cgi-bin/gnis.cgi?vid=nsfmod.edu&tfaction=arquerypincorp&Lat=25.54&Long=-80.36&filetype=.xml&arcriteria=1&pop100<=60000

Returns incorporated places whose name contains Pensacola OR Gulf AND whose median residents age is less than 35:

http://vn4.cs.fiu.edu/cgi-bin/gnis.cgi?vid=nsfmod.edu&tfaction=arquerypincorp&Lat=25.54&Long=-80.36&filetype=.xml&arcriteria=1&sname&vert=Pensacola+Gulf&sf1P013001<35

Returns incorporated places whose name does NOT contain Pensacola AND whose population is over 60,000: http://vn4.cs.fiu.edu/cgi-bin/gnis.cgi?vid=nsfmod.edu&tfaction=arquerypincorp&Lat=25.54&Long=-80.36&filetype=.xml&arcriteria=1&sname!=Pensacola&pop100>=60000

Returns auto service businesses with street numbers between 300 and 37000 and that contain SHELL in their name: http://vn4.cs.fiu.edu/cgi-bin/gnis.cgi?vid=nsfmod.edu&tfaction=arquerynv_autosvc&Lat=25.54&Long=-80.36&arcriteria=1&POI_ST_NUM>=300&POI_ST_NUM<=37000&POI_NAME=SHELL&anyfield=st&filetype=.xml


2.7. GeoQuery URL Interface Parameters

The GeoQuery URL interface passes parameters to backend systems. The available parameters depend on the dataset being queried. Not all parameters are modifiable or usable for all datasets.

Below you will find two tables; Table 3 contains standard parameters that are used for all datasets, and Table 4 contains modifier parameters that only work for certain datasets.

GeoQuery Format:

<PATH TO ACCESS SCRIPT>?<TF ACTION LIST><parameters other than the dataset's fields>arcriteria=1&<parameters searching dataset's fields>

Example:

Returns incorporated places whose name contains Pensacola OR Gulf AND whose median residents age is less than 35: http://vn4.cs.fiu.edu/cgi-bin/gnis.cgi?vid=nsfmod.edu&tfaction=arquerypincorp&tfaction=longdisplay&Lat=25.54&Long=-80.36&filetype=.xml&arcriteria=1&sname|=Pensacola+Gulf&sf1P013001<35

Table 3 - Standard Parameters

Standard Parameter

Usage and Description

 

<Field Name>

Usage:

<Field Name><OP><VALUE>

Description:

A generic name given to concrete field names on a dataset-by-dataset basis. Users can use the <Field Name> and return results based on the operator <OP> and the <VALUE> being applied to that particular <Field Name> In the example below sname plays the role of <Field Name.

 

Example:

The example below returns all incorporated place whose “sname” field is contains the string “Pensacola”.

 

http://vn4.cs.fiu.edu/cgi-bin/gnis.cgi?vid=nsfmod.edu&tfaction=arquerypincorp&Lat=25.54&Long=-80.36&filetype=.xml&arcriteria=1&sname=Pensacola

 

*See Section 1.6 for more examples

 

place_name

Usage:

place_name

 

Description:

Allows users to assign a label to the location being queried. Only usable when

presenting results in HTML format

 

Example:

The name of the queried location is assigned as “My Favorite Place”

 

http://vn4.cs.fiu.edu/cgi-bin/gnis.cgi?vid=nsfmod.edu&tfaction=arqueryMOA_DB_UNION&place_name=My%20Favorite%20Place&Lat=25.54&Long=-80.36

 

vid

Usage:

vid

 

Description:

This is the id that has been assigned to you for authentication.

 

lat

Usage:

lat=< LATITUDE>;

A valid Latitude value is -90 to 90.

 

Description:

The latitude of the queried location.

 

long

Usage:

long=< LONGITUDE>

A valid Longitude value is -180 to 180

 

Description:

The longitude of the queried location.

 

Table 4 - Modifier Parameters

Modifier Parameter

Usage and Description

discard_proximal_duplicates

Usage:

discard_proximal_duplicates

 

If a distance value <dist> is provided, then it applies the proximal discarding algorithm

with argument <dist> in miles.

 

Description:

The algorithm is as follows. The first nearest neighbor object is placed in the result set. Then, the second nearest object is discarded if its distance to the last object placed in the result set is less than <dist> miles; otherwise, it is placed in the result set. The algorithm continues for subsequent objects, in nearest neighbor order, until the requested number of objects have been collected. Note, in searching for top-k objects, this algorithm may retrieve more than k objects to satisfy the query.

 

Example:

 

discard_proximal_duplicates=0.1

 

Let us consider nearest neighbor objects as: O1, O2, O3.

 

O2 is discarded if its distance to objects O1 is less than 0.1 miles; otherwise, O2 is added to the final query result and becomes the last object placed in the result set.

 

discard_approximate_locations

Usage:

discard_approximate_locations

Defaults to 0; 1 means yes.

 

Description:

Discard_approximate_locations will filter out objects with non-precise coordinates. That is, those objects for which our system was not able to compute accurate coordinates.

 

numfind

 

Usage:

numfind

 

Description:

Number of closest points to return. This parameter is conjunctive to search criteria and radius parameters. If the value of numfind exceed the allowable value, it will be decreased.

 

Example:

Returns only the first 3 records of the query

http://vn4.cs.fiu.edu/cgi-bin/gnis.cgi?vid=nsfmod.edu&tfaction=arquerypincorp&Lat=25.54&Long=-80.36&filetype=.xml&arcriteria=1&numfind=3

 

Timeout

Usage:

timeout=<INTEGER>

 

Description:

Query execution time limit in seconds

 

d

Usage:

d=<NUMBER>

The Default is context-dependent

 

Description:

Search radius in miles

 


2.8. Miscellaneous

Special Constant for Searching NULL values:

There is a special, case-insensitive constant “_null” used to search for NULL values in dataset fields. When the field is known by the system to be of type numeric, then zero values are assumed to be equivalent to “_null”.

Example:

Returns objects where the value of the field areawatr is null (i.e. the field is empty or the numeric field has the value 0):

http://vn4.cs.fiu.edu/cgi-bin/gnis.cgi?vid=nsfmod.edu&tfaction=arquerypincorp&Lat=25.54&Long=-80.36&filetype=.xml&areawatr=_null

Not null: http://vn4.cs.fiu.edu/cgi-bin/gnis.cgi?vid=nsfmod.edu&tfaction=arquerypincorp&Lat=25.54&Long=-80.36&filetype=.xml&areawatr!=_null


3. FAQ


Number-of-records: How many records are returned by the query?

A: There is a default that can be overwritten with "numfind=..."


Limiting-Radius: How do we limit radius of the records to be retrieved?

A: The default radius is normally infinite -- we retrieve a limited number of matching records nearest to the given point, even if the nearest matching record is on another continent. This, however, can be user-constrained to a radius using the "d=" parameter.


Radius: What is the geographic radius within which records a returned by a query?

A: The semantics of a GeoQuery is "for a given point and criteria, get the records complying with the criteria and sorted by distance to the point". The user can override defaults for the maximum number of records to return (numfind=) and maximum distance (d=). d=Radius.


Metadata: What is the meaning and format of each field in the dataset?

A: The datafeed portal page is subdivided into sections headed by the dataset title. The first link under every such title is to the metadata, including descriptions of all columns.


Distance+Offset: What are the offset and compass directions columns?

A: The distance, offset and compass direction attributes are computed in real time, calculated by the difference between the record's latitude and longitude, and the query (URL) latitude and longitude:

latLatitude of the location of this object
lonLongitude of the location of this object
distanceDistance in meters of the location of this object from the reference point
compass_directionCompass direction (N W E S NW NE SW SE) towards the location of this object from the reference point
offsetNormally not computed, but may be computed as the angular difference in degrees between the approximate discrete compass_direction and the exact numeric compass direction


Search-nearby: Does GeoQuery returns the records of the nearby areas if there is no data at the given coordinates?

A: Yes


Coordinates-in-XML: Where in XML files do I find coordinates of the resultant records?

A: In fields “lat” and “lon” at the end of the record.

© 2024 Naphtali Rishe