Updates IP addresses geocoder docs
This commit is contained in:
@@ -3,9 +3,12 @@ IP address geocoder
|
|||||||
|
|
||||||
# Function
|
# Function
|
||||||
|
|
||||||
````
|
Receives an array of IP addresses (both IPv4 and IPv6) and returns a point geometry for each input if the geocoding process is successful.
|
||||||
|
|
||||||
|
# Usage example
|
||||||
|
```sql
|
||||||
SELECT geocode_ip(Array['1.0.16.0', '::ffff:1.0.16.0'])
|
SELECT geocode_ip(Array['1.0.16.0', '::ffff:1.0.16.0'])
|
||||||
`````
|
```
|
||||||
|
|
||||||
# Creation steps
|
# Creation steps
|
||||||
1. Create the `ip_address_locations` table
|
1. Create the `ip_address_locations` table
|
||||||
@@ -53,14 +56,17 @@ Indexes:
|
|||||||
* GeoLite2 open source database [Created by MaxMind](http://www.maxmind.com) -
|
* GeoLite2 open source database [Created by MaxMind](http://www.maxmind.com) -
|
||||||
http://dev.maxmind.com/geoip/geoip2/geolite2/
|
http://dev.maxmind.com/geoip/geoip2/geolite2/
|
||||||
Download the CSV [Geolite2 City](http://geolite.maxmind.com/download/geoip/database/GeoLite2-City-CSV.zip)
|
Download the CSV [Geolite2 City](http://geolite.maxmind.com/download/geoip/database/GeoLite2-City-CSV.zip)
|
||||||
|
- Coverage: global
|
||||||
|
- Geometry type: point
|
||||||
|
|
||||||
# Testing
|
# Testing
|
||||||
In order to test the data and the functions created under the script avaialble in this folder, you will need to run `bash test.sh` from `test/data` and `test/functions`.
|
In order to test the data and the functions created under the script avaialble in this folder, you will need to run `bash test.sh` from `test/data` and `test/functions`.
|
||||||
|
|
||||||
# Known issues
|
# Known issues
|
||||||
* IPv6 addresses support?
|
|
||||||
|
|
||||||
# Historic:
|
# Historic:
|
||||||
|
* [19/10/2015]:
|
||||||
|
* Updates README and adds usage example and definition of the service
|
||||||
* [08/10/2015]:
|
* [08/10/2015]:
|
||||||
* Added response data types
|
* Added response data types
|
||||||
* [14/07/2015]:
|
* [14/07/2015]:
|
||||||
@@ -71,5 +77,3 @@ In order to test the data and the functions created under the script avaialble i
|
|||||||
* [23/06/2015]:
|
* [23/06/2015]:
|
||||||
* Updates `README.md`: adds testing and table structure sections. Updates creation steps
|
* Updates `README.md`: adds testing and table structure sections. Updates creation steps
|
||||||
* Adding test structure for IP addresses geocoder
|
* Adding test structure for IP addresses geocoder
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
|
|
||||||
---- IP addresses table ---
|
---- IP addresses table ---
|
||||||
--- ---
|
|
||||||
|
|
||||||
-- Clear table
|
-- Clear table
|
||||||
|
|
||||||
DELETE FROM ip_address_locations;
|
DELETE FROM ip_address_locations;
|
||||||
|
-- Updates table with new source data
|
||||||
INSERT INTO ip_address_locations (the_geom, network_start_ip) SELECT the_geom, network_start_ip::inet FROM latest_ip_address_locations;
|
INSERT INTO ip_address_locations (the_geom, network_start_ip) SELECT the_geom, network_start_ip::inet FROM latest_ip_address_locations;
|
||||||
DROP TABLE latest_ip_address_locations;
|
DROP TABLE latest_ip_address_locations;
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
-- Index on IP addresses table
|
||||||
|
CREATE UNIQUE INDEX idx_ip_address_locations_start ON ip_address_locations (network_start_ip)
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
-- Response types for IP addresses geocoder
|
||||||
|
CREATE TYPE geocode_ip_v1 AS (q TEXT, geom GEOMETRY, success BOOLEAN);
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
-- Triggers for IP addresses geocoder
|
||||||
|
|||||||
Reference in New Issue
Block a user