Commit b903b1e9 authored by Felix Delattre's avatar Felix Delattre

add region for Nakano, Japan, include first instructions on doing an extract

parent 7a1446d7
# OBM Calculations
This is a start to document the OpenBuildingMap. Please be aware that this is not complete at all.
* [How to make an extract](./howto-extract.md)
\ No newline at end of file
# How to make an extract from OpenBuildingMap
* Login to the server your database is running on.
* Check which regions are already defined:
- Connect to OBM buildings datatbase
- `select id,name from obm_region;`
* If your region is not defined already:
- Create a copy of `./sql/data_related/interested_region_nakano.sql` and define your region
- Execute it against the database to create the region
* To create an extract:
- Create a copy of `./sql/extracts/nakano.sql` and specify names and id of the region
- Execute the queries and create the files
* Move them to some downloadable space
* Clean up after you -> Files and database table created for extract
INSERT INTO obm_region (name, way) VALUES
(
'Nakano',
ST_GeomFromText('
MULTIPOLYGON(((139.6709601238218 35.6749064394809,139.670853959287285 35.675501884044088,139.670415453601208 35.677629790583865,139.669943098353343 35.679665380137102,139.669596909653791 35.68109167757919,139.669458434174004 35.682919553912718,139.669306111146227 35.684387393998726,139.66884914206284 35.688652438776934,139.668876837158933 35.689074788990361,139.668973769994807 35.689670233553556,139.669188406988468 35.690508010206436,139.669181483214516 35.690833427583996,139.668849142062982 35.69249513334173,139.668620657521302 35.693402147734503,139.668392172979566 35.694274543257329,139.668205231081913 35.694433790059115,139.66729129291511 35.695815082970242,139.667405535185992 35.697435246084048,139.667613248405701 35.699138494485737,139.667509391795846 35.699678548856994,139.666907023458663 35.701350640275741,139.666605839290071 35.701745295393195,139.665619201496384 35.702700776203898,139.6655361162085 35.70308504566038,139.665369945632733 35.705993030736416,139.672795693237703 35.705982645075444,139.672650293983907 35.706585013412656,139.67272299361079 35.708516746356032,139.673013792118411 35.709191814320107,139.67164288486822 35.709409913200801,139.670033107415406 35.709731868691357,139.668579114877417 35.709887653606138,139.666740852882924 35.710001895877006,139.664923362210374 35.70997073889405,139.65417420308998 35.709690326047451,139.653769162311534 35.713595334578152,139.653789933633504 35.719494390018141,139.645678732403525 35.722121962247591,139.644401296102274 35.722475074721103,139.643622371528295 35.722568545669972,139.642594191090723 35.722610088313921,139.638107585544788 35.72270355926279,139.638273756120554 35.725518073389978,139.63864763991603 35.726296997963942,139.633600208676881 35.727096693859842,139.633143239593522 35.727221321791674,139.631689247055505 35.727231707452667,139.625068388177056 35.727330371232043,139.614482803217129 35.727805515222144,139.614221863484858 35.722403673301848,139.614046605455741 35.718968615930748,139.615028050418886 35.708102618124229,139.616500217863631 35.702739722432597,139.617481662826833 35.698007755645904,139.617832178885067 35.696360330171977,139.617691972461785 35.695378885208839,139.616885785527757 35.692890221195071,139.616570321075272 35.691277847326994,139.615658979323769 35.685319074336334,139.615588876112128 35.684092268132346,139.615623927717962 35.68323350378958,139.615308463265478 35.68226958462931,139.614712585966402 35.680779891381668,139.614572379543119 35.679570610980605,139.614309492499416 35.677274730798906,139.613766192609091 35.674628334558932,139.613503305565388 35.672945857479199,139.613363099142077 35.670246883830465,139.630818798844189 35.667740694013816,139.641137115309704 35.666202804808115,139.642004642553928 35.666084505638459,139.642780159332858 35.666110794342821,139.64358196481615 35.666294815273432,139.650509038417852 35.668358478566518,139.657383534610744 35.670376136626984,139.6709601238218 35.6749064394809)))
', 4326)
)
;
-- this selects the nakano region
EXPLAIN
SELECT
b.*
INTO TABLE exports.nakano
FROM exp_buildings AS b
JOIN obm_region AS r
ON (r.id = 18 AND ST_Intersects(b.way, ST_Transform(r.way, 900913)))
;
-- export to Shape file set:
-- pgsql2shp -f nakano_20200701 -g way gis exports.nakano
-- tar -cpvJf nakano.tar.xz nakano_20200701.???
-- export to CSV:
-- \copy (SELECT * FROM exports.japan) TO '/var/tmp/obm-japan-20200623.csv' DELIMITER ',' CSV HEADER
-- SQL dump:
-- time pg_dump --format=d --file=nakano_20200701.sql --column-inserts --no-owner --no-tablespaces --clean --verbose --jobs=12 --table=exports.nakano gis
-- tar -cpvJf nakano_20200701.sql.tar.xz nakano_20200701.sql
-- get them back in readable coordinates:
-- SELECT id, name, ST_AsText(ST_Transform(ST_Transform(region_of_interest, 900913), 4326)) FROM compute_regions_only;
......@@ -10,8 +10,8 @@ JOIN obm_region AS r
;
-- export to Shape file set:
-- pgsql2shp -f 20191219_cecilia_attica -g way gis exports.cecilia_attica
-- tar -cpvJf 20191219_cecilia_attica.tar.xz 20191219_cecilia_attica.???
-- pgsql2shp -f padang_20200622 -g way gis exports.padang
-- tar -cpvJf padang.tar.xz padang_20200622.???
-- SQL dump:
-- time pg_dump --format=d --file=padang_20200622.sql --column-inserts --no-owner --no-tablespaces --clean --verbose --jobs=12 --table=exports.padang gis
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment