geosketch_data_origin
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
geosketch_data_origin [2022/12/13 20:58] – [Fix Rivers] jhagstrand | geosketch_data_origin [2023/01/12 03:08] (current) – removed jhagstrand | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Geosketch Data Origin ====== | ||
- | |||
- | 4 dec 2022 re-create plunder database in a2hosting | ||
- | |||
- | database: **voyccom_plunder** | ||
- | |||
- | used by both plunder and geosketch | ||
- | * geosketch is used to update the data | ||
- | * plunder reads the data | ||
- | |||
- | Historical note: three databases were used at webfaction. | ||
- | - jhagstrand_plunder - the original plunder database of geographical data. | ||
- | - voyc - used temporarily for building some of the plunder data js files. | ||
- | - jhagstrand_voyc - the historical political data used in voyc. | ||
- | |||
- | In the move from webfaction to a2hosting, those second two files were lost. | ||
- | That is not critical, because they were used only temporarily. | ||
- | |||
- | Plunder loads its data from static js files, generated from the database. | ||
- | |||
- | Voyc uses google maps api, and therefore does not need geographical data. | ||
- | |||
- | Going forward, we will rebuild the voyccom_plunder database. | ||
- | It will contain all the geographic data for drawing the map. | ||
- | It will also contain political data, copied from the Voyc database. | ||
- | How will we resolve this dual maintenance of the political data? | ||
- | |||
- | ==== Create the database ==== | ||
- | |||
- | Create voyccom_plunder database on a2hosting/ | ||
- | |||
- | Create the schema | ||
- | |||
- | psql -d voyccom_plunder -U voyccom_jhagstrand -c " | ||
- | |||
- | ==== Load in the OSM-Tilemill archive ==== | ||
- | |||
- | This is evidently an older version of data found on natural earth data website. | ||
- | |||
- | cd ~/ | ||
- | wget https:// | ||
- | unzip -j master */ | ||
- | shp2pgsql -c -W LATIN1 10m_geography_regions_polys plunder.georegions > | ||
- | psql -d voyccom_plunder -U voyccom_jhagstrand < | ||
- | |||
- | This creates a table named georegions containing 1048 records classified by terrain type. | ||
- | |||
- | select gid, scalerank, featurecla, name, namealt, region, subregion, geom from plunder.georegions; | ||
- | |||
- | ==== Load rivers from natural earth data ==== | ||
- | |||
- | cd ~/ | ||
- | wget http:// | ||
- | unzip -j ne_50m_rivers_lake_centerlines.zip | ||
- | shp2pgsql -c -W LATIN1 ne_50m_rivers_lake_centerlines plunder.rivers50 > | ||
- | psql -d voyccom_plunder -U voyccom_jhagstrand < | ||
- | |||
- | |||
- | select guid, scalerank, featurecla, name, note, min_zoom, name_alt, min_label, name_en, label | ||
- | from plunder.rivers50 | ||
- | |||
- | ==== Load lakes and seas data from natural earth data ==== | ||
- | |||
- | cd ~/ | ||
- | wget https:// | ||
- | unzip ne_50m_lakes.zip | ||
- | shp2pgsql -c -W LATIN1 ne_50m_lakes plunder.lakes50 > | ||
- | psql -d voyc -U jhagstrand < | ||
- | |||
- | |||
- | |||
- | A table on this page includes names of the major seas. | ||
- | https:// | ||
- | |||
- | ==== Load politial data from voyc/fpd ==== | ||
- | |||
- | fpd.fpd contains 565,080 million rows | ||
- | |||
- | empire.js contains 428 rows | ||
- | |||
- | treasure.js contains 67 rows | ||
- | |||
- | |||
- | Copy the fpd table from voyc to plunder | ||
- | |||
- | pg_dump -Fp -b -O --column-inserts -U voyccom_jhagstrand -n fpd -f dumpvoyc.sql voyccom_voyc | ||
- | | ||
- | psql -d voyccom_plunder -U voyccom_jhagstrand < | ||
- | |||
- | |||
- | ==== Combine source tables into one ==== | ||
- | |||
- | Create master table plunder.plunder. | ||
- | |||
- | SET CLIENT_ENCODING TO UTF8; | ||
- | SET STANDARD_CONFORMING_STRINGS TO ON; | ||
- | create table plunder.plunder ( | ||
- | id serial, | ||
- | source varchar, | ||
- | gid integer, | ||
- | name varchar, | ||
- | featureclass varchar, | ||
- | scalerank integer, | ||
- | timebegin double precision, | ||
- | timeend double precision, | ||
- | maptype integer, | ||
- | datatype integer, | ||
- | forebear integer, | ||
- | color integer | ||
- | ); | ||
- | ALTER TABLE plunder.plunder ADD PRIMARY KEY (id); | ||
- | SELECT AddGeometryColumn(' | ||
- | |||
- | Load empire and treasure data. | ||
- | |||
- | insert into plunder.plunder ( | ||
- | source, | ||
- | maptype, | ||
- | select | ||
- | ' | ||
- | maptype, | ||
- | from fpd.fpd | ||
- | where editstatus < 10 | ||
- | and maptype in (3,4) | ||
- | and datatype in (2, | ||
- | | ||
- | insert into plunder.plunder ( | ||
- | source, | ||
- | maptype, | ||
- | select | ||
- | ' | ||
- | maptype, | ||
- | from fpd.fpd | ||
- | where editstatus < 10 | ||
- | and maptype = 2 | ||
- | and datatype in (2, | ||
- | and timebegin < 1900; | ||
- | |||
- | Load osmtilemill data into plunder table. | ||
- | |||
- | insert into plunder.plunder ( | ||
- | source, | ||
- | select | ||
- | ' | ||
- | from plunder.georegions; | ||
- | | ||
- | Load rivers data into plunder table. | ||
- | |||
- | insert into plunder.plunder ( | ||
- | source, | ||
- | select | ||
- | ' | ||
- | from plunder.rivers50; | ||
- | |||
- | Load lakes data into plunder table. | ||
- | |||
- | insert into plunder.plunder ( | ||
- | source, | ||
- | select | ||
- | ' | ||
- | from plunder.lakes50; | ||
- | |||
- | Massage | ||
- | update plunder.plunder set featureclass = lower(featureclass); | ||
- | |||
- | ==== File Folder Structure ==== | ||
- | |||
- | geosketch/ | ||
- | geosketch/ | ||
- | geosketch/ | ||
- | |||
- | The datasource directory is not put in github, because the data is all zipped. | ||
- | But we retain a copy of it all anyway, in case it gets deleted from the cloud someday, | ||
- | and we need it for recovery. | ||
- | |||
- | This page documents how the the zipped shapefiles in datasource were loaded into | ||
- | the plunder database. | ||
- | |||
- | ==== Delete the temp tables ==== | ||
- | |||
- | Keep plunder.plunder.\\ | ||
- | plunder.plunder 2433 rows\\ | ||
- | |||
- | Drop the others.\\ | ||
- | plunder.georegions 1048 rows\\ | ||
- | plunder.rivers50 478 rows\\ | ||
- | pluner.lakes50 412 rows\\ | ||
- | fpd.fpd 565,080 rows\\ | ||
- | |||
- | drop table plunder.georegions; | ||
- | drop table plunder.rivers50; | ||
- | drop table pluner.lakes50; | ||
- | drop table fpd.fpd; | ||
- | drop schema fpd cascade; | ||
- | |||
- | ==== Fix Rivers ==== | ||
- | |||
- | select id, name, scalerank from plunder.plunder where id in (2009, | ||
- | update plunder.plunder set scalerank=6 where id in (2009, | ||
- | |||
- | |||
- | ? | ||
- | Wabash river, going n and e from the Ohio off of the Mississippi | ||
- | at the bend where it turns from n to e | ||
- | hit test returns Kyzyl-Khem as well as Wabash | ||
geosketch_data_origin.1670983085.txt.gz · Last modified: 2022/12/13 20:58 by jhagstrand