Update API.md
This commit is contained in:
parent
f18feb4bc0
commit
cbbd58d5d0
179
doc/API.md
179
doc/API.md
@ -4,22 +4,102 @@
|
||||
### Quickstart
|
||||
### General concepts
|
||||
### Reference
|
||||
#### Free geocoding functions
|
||||
#### Geocoding functions
|
||||
##### Country geocoder functions
|
||||
###### geocode_admin0_polygon
|
||||
* Description:
|
||||
This function receives a country name and returns a polygon geometry (SRID 4326) for the corresponding input.
|
||||
* Functions:
|
||||
* `geocode_admin0_polygon(country_name text)`
|
||||
* **Parameters**: A text parameter with the name of the country to geocode.
|
||||
* **Return type:** `polygon`
|
||||
* **Usage example:**
|
||||
`````
|
||||
SELECT geocode_admin0_polygon('France')
|
||||
`````
|
||||
|
||||
##### geocode_admin0_polygon(countryname text)
|
||||
##### geocode_admin1_polygon(adminname text)
|
||||
##### geocode_admin1_polygon(adminname text, countryname text)
|
||||
##### geocode_namedplace_point(city text)
|
||||
##### geocode_namedplace_point(city text, country text)
|
||||
##### geocode_namedplace_point(city text, admin1 text, country text)
|
||||
##### geocode_postalcode_polygon(code text, country text)
|
||||
##### geocode_postalcode_point(code text, country text)
|
||||
##### geocode_ip_point(ipaddress text)
|
||||
#### Level-1 Administrative regions geocoder
|
||||
###### geocode_admin1_polygon
|
||||
* Functions:
|
||||
* `geocode_admin1_polygon(admin1_name text)`
|
||||
* **Parameters**:
|
||||
* **Return type:** `polygon`
|
||||
* **Usage example:**
|
||||
`````
|
||||
SELECT geocode_admin1_polygon('Alicante')
|
||||
`````
|
||||
|
||||
* `geocode_admin1_polygon(admin1_name text, country_name text)`
|
||||
* **Parameters**:
|
||||
* **Return type:** `polygon`
|
||||
* **Usage example:**
|
||||
`````
|
||||
SELECT geocode_admin1_polygon('Alicante', 'Spain')
|
||||
`````
|
||||
|
||||
#### City geocoder
|
||||
##### geocode_namedplace_point
|
||||
* Functions:
|
||||
* `geocode_namedplace_point(city_name text)`
|
||||
* **Parameters**:
|
||||
* **Return type:** `point`
|
||||
* **Usage example:**
|
||||
`````
|
||||
SELECT geocode_namedplace_point('Barcelona')
|
||||
`````
|
||||
|
||||
* `geocode_namedplace_point(city_name text, country_name text)`
|
||||
* **Parameters**:
|
||||
* **Return type:** `point`
|
||||
* **Usage example:**
|
||||
`````
|
||||
SELECT geocode_namedplace_point('Barcelona', 'Spain')
|
||||
`````
|
||||
|
||||
* `geocode_namedplace_point(city_name text, admin1_name text, country_name text)`
|
||||
* **Parameters**:
|
||||
* **Return type:** `point`
|
||||
* **Usage example:**
|
||||
`````
|
||||
SELECT geocode_namedplace_point('New York', 'New York', 'USA')
|
||||
`````
|
||||
|
||||
#### Postal codes geocoder
|
||||
##### geocode_postalcode_polygon
|
||||
* Functions:
|
||||
* `geocode_postalcode_polygon(code text, country_name text)`
|
||||
* **Parameters**:
|
||||
* **Return type:** `polygon`
|
||||
* **Usage example:**
|
||||
`````
|
||||
SELECT geocode_postalcode_polygon('11211', 'USA')
|
||||
`````
|
||||
|
||||
##### geocode_postalcode_point
|
||||
* Functions:
|
||||
* `geocode_postalcode_point(code text, country_name text)`
|
||||
* **Parameters**:
|
||||
* **Return type:** `point`
|
||||
* **Usage example:**
|
||||
`````
|
||||
SELECT geocode_postalcode_point('11211', 'USA')
|
||||
`````
|
||||
|
||||
#### IP addresses Geocoder
|
||||
##### geocode_ip_point(ipaddress text)
|
||||
* Functions:
|
||||
* `geocode_ip_point(ipaddress text)`
|
||||
* **Parameters**:
|
||||
* **Return type:** `point`
|
||||
* **Usage example:**
|
||||
`````
|
||||
SELECT geocode_ip_point('102.23.34.1')
|
||||
`````
|
||||
|
||||
|
||||
For each function:
|
||||
For each function:
|
||||
function names
|
||||
function parameters and types (most of them are text params)
|
||||
function parameters and types
|
||||
return type for the functions (Geometry or NULL if not found, with SRID 4326)
|
||||
a description of the handling of any error condition
|
||||
pre- and post-conditions or invariants
|
||||
@ -27,79 +107,6 @@ possible side-effects
|
||||
|
||||
|
||||
|
||||
### Country geocoder
|
||||
* Description:
|
||||
|
||||
This function receives a country name and returns a polygon geometry (SRID 4326) for the corresponding input.
|
||||
* Functions:
|
||||
* `geocode_admin0_polygon(countryname text)`
|
||||
* **Return type:** `polygon`
|
||||
* **Usage example:**
|
||||
`````
|
||||
SELECT geocode_admin0_polygon('France')
|
||||
`````
|
||||
|
||||
### Level-1 Administrative regions geocoder
|
||||
* Functions:
|
||||
* `geocode_admin1_polygon(adminname text)`
|
||||
* **Return type:** `polygon`
|
||||
* **Usage example:**
|
||||
`````
|
||||
SELECT geocode_admin1_polygon('Alicante')
|
||||
`````
|
||||
|
||||
* `geocode_admin1_polygon(adminname text, countryname text)`
|
||||
* **Return type:** `polygon`
|
||||
* **Usage example:**
|
||||
`````
|
||||
SELECT geocode_admin1_polygon('Alicante', 'Spain')
|
||||
`````
|
||||
|
||||
### Cities geocoder
|
||||
* Functions:
|
||||
* `geocode_namedplace_point(city text)`
|
||||
* **Return type:** `point`
|
||||
* **Usage example:**
|
||||
`````
|
||||
SELECT geocode_namedplace_point('Barcelona')
|
||||
`````
|
||||
|
||||
* `geocode_namedplace_point(city text, country text)`
|
||||
* **Return type:** `point`
|
||||
* **Usage example:**
|
||||
`````
|
||||
SELECT geocode_namedplace_point('Barcelona', 'Spain')
|
||||
`````
|
||||
|
||||
* `geocode_namedplace_point(city text, admin1 text, country text)`
|
||||
* **Return type:** `point`
|
||||
* **Usage example:**
|
||||
`````
|
||||
SELECT geocode_namedplace_point('New York', 'New York', 'USA')
|
||||
`````
|
||||
|
||||
### Postal codes geocoder
|
||||
* Functions:
|
||||
* `geocode_postalcode_polygon(code text, country text)`
|
||||
* **Return type:** `polygon`
|
||||
* **Usage example:**
|
||||
`````
|
||||
SELECT geocode_postalcode_polygon('11211', 'USA')
|
||||
`````
|
||||
|
||||
* `geocode_postalcode_point(code text, country text)`
|
||||
* **Return type:** `point`
|
||||
* **Usage example:**
|
||||
`````
|
||||
SELECT geocode_postalcode_point('11211', 'USA')
|
||||
`````
|
||||
|
||||
|
||||
### IP addresses Geocoder
|
||||
* Functions:
|
||||
* `geocode_ip_point(ipaddress text)`
|
||||
* **Return type:** `point`
|
||||
* **Usage example:**
|
||||
`````
|
||||
SELECT geocode_ip_point('102.23.34.1')
|
||||
`````
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user