the real deal geoipdata

This commit is contained in:
scott comer 2014-03-04 10:41:00 -06:00
parent 7a991a8032
commit f0a0f9f2f2
5 changed files with 4828878 additions and 0 deletions

4262772
db/geodata/GeoIPBlocks.sql Normal file

File diff suppressed because it is too large Load Diff

125470
db/geodata/GeoIPISP.sql Normal file

File diff suppressed because it is too large Load Diff

440606
db/geodata/GeoIPLocations.sql Normal file

File diff suppressed because it is too large Load Diff

1
db/geodata/README.txt Normal file
View File

@ -0,0 +1 @@
this is just for getting this maxmind data over there so i can use it.

29
db/geodata/supplement.sql Normal file
View File

@ -0,0 +1,29 @@
-- to load the geoip data:
-- psql -U postgres -d geoip -f GeoIPLocations.sql
-- psql -U postgres -d geoip -f GeoIPBlocks.sql
-- psql -U postgres -d geoip -f GeoIPISP.sql
-- psql -U postgres -d geoip -f supplement.sql
DELETE FROM jamcompany;
ALTER SEQUENCE jamcompany_coid_seq RESTART WITH 1;
INSERT INTO jamcompany (company) SELECT DISTINCT company FROM geoipisp ORDER BY company;
DELETE FROM jamisp;
INSERT INTO jamisp (beginip, endip, coid) SELECT x.beginip, x.endip, y.coid FROM geoipisp x, jamcompany y WHERE x.company = y.company;
ALTER TABLE geoiplocations DROP COLUMN geog;
ALTER TABLE geoiplocations ADD COLUMN geog geography(point, 4326);
UPDATE geoiplocations SET geog = ST_SetSRID(ST_MakePoint(longitude, latitude), 4326)::geography;
CREATE INDEX geoiplocations_geog_gix ON geoiplocations USING GIST (geog);
ALTER TABLE geoipblocks DROP COLUMN geom;
ALTER TABLE geoipblocks ADD COLUMN geom geometry(polygon);
UPDATE geoipblocks SET geom = ST_MakeEnvelope(beginip, -1, endip, 1);
CREATE INDEX geoipblocks_geom_gix ON geoipblocks USING GIST (geom);
ALTER TABLE jamisp DROP COLUMN geom;
ALTER TABLE jamisp ADD COLUMN geom geometry(polygon);
UPDATE jamisp SET geom = ST_MakeEnvelope(beginip, -1, endip, 1);
CREATE INDEX jamisp_geom_gix ON jamisp USING GIST (geom);
VACUUM ANALYSE;