rkaneko
5 years ago
6 changed files with 250 additions and 8 deletions
-
5docker-compose.yml
-
BINdocs/img/kagoshima_segments.png
-
61docs/practices.md
-
49sql/japan_segments.sql
-
5sql/schema.sql
-
138test/test_example.py
After Width: 1185 | Height: 945 | Size: 222 KiB |
@ -0,0 +1,61 @@ |
|||
SQL practices |
|||
=== |
|||
|
|||
### ToC |
|||
|
|||
- [Practice 1](#practice-1) |
|||
- [Practice 2](#practice-2) |
|||
- [Practice 3](#practice-3) |
|||
|
|||
# Practice 1 |
|||
|
|||
- Count the number of subordinate 'ENTERPRISE\_CUSTOMER' organizations for each organization. |
|||
|
|||
# Practice 2 |
|||
|
|||
- Calculate the center of each `japan_segment`. |
|||
|
|||
# Practice 3 |
|||
|
|||
- Select `japan_segments` within the bounds represented as the following GeoJSON. |
|||
|
|||
```json |
|||
{ |
|||
"type": "FeatureCollection", |
|||
"features": [ |
|||
{ |
|||
"type": "Feature", |
|||
"properties": {}, |
|||
"geometry": { |
|||
"type": "Polygon", |
|||
"coordinates": [ |
|||
[ |
|||
[ |
|||
130.27313232421875, |
|||
30.519681272749402 |
|||
], |
|||
[ |
|||
131.02020263671875, |
|||
30.519681272749402 |
|||
], |
|||
[ |
|||
131.02020263671875, |
|||
30.80909017893796 |
|||
], |
|||
[ |
|||
130.27313232421875, |
|||
30.80909017893796 |
|||
], |
|||
[ |
|||
130.27313232421875, |
|||
30.519681272749402 |
|||
] |
|||
] |
|||
] |
|||
} |
|||
} |
|||
] |
|||
} |
|||
``` |
|||
|
|||
![Kagoshima segments](./img/kagoshima_segments.png) |
@ -0,0 +1,49 @@ |
|||
begin; |
|||
|
|||
INSERT INTO japan_segments ( |
|||
id, |
|||
bounds |
|||
) VALUES |
|||
( |
|||
'KAGOSHIMA_1' |
|||
, ST_GeomFromEWKT('SRID=4326;POLYGON((130.616250541204 30.6818181818182,130.616250541204 30.7272727272727,130.668206090345 30.7272727272727,130.668206090345 30.6818181818182,130.616250541204 30.6818181818182))') |
|||
) |
|||
,( |
|||
'KAGOSHIMA_2' |
|||
, ST_GeomFromEWKT('SRID=4326;POLYGON((130.668206090345 30.6818181818182,130.668206090345 30.7272727272727,130.720161639486 30.7272727272727,130.720161639486 30.6818181818182,130.668206090345 30.6818181818182))') |
|||
) |
|||
,( |
|||
'KAGOSHIMA_3' |
|||
, ST_GeomFromEWKT('SRID=4326;POLYGON((130.720161639486 30.6818181818182,130.720161639486 30.7272727272727,130.772117188628 30.7272727272727,130.772117188628 30.6818181818182,130.720161639486 30.6818181818182))') |
|||
) |
|||
,( |
|||
'KAGOSHIMA_4' |
|||
, ST_GeomFromEWKT('SRID=4326;POLYGON((129.68105065666 30.7272727272727,129.68105065666 30.7727272727273,129.733006205802 30.7727272727273,129.733006205802 30.7272727272727,129.68105065666 30.7272727272727))') |
|||
) |
|||
,( |
|||
'KAGOSHIMA_5' |
|||
, ST_GeomFromEWKT('SRID=4326;POLYGON((129.733006205802 30.7272727272727,129.733006205802 30.7727272727273,129.784961754943 30.7727272727273,129.784961754943 30.7272727272727,129.733006205802 30.7272727272727))') |
|||
) |
|||
,( |
|||
'KAGOSHIMA_6' |
|||
, ST_GeomFromEWKT('SRID=4326;POLYGON((129.784961754943 30.7272727272727,129.784961754943 30.7727272727273,129.836917304084 30.7727272727273,129.836917304084 30.7272727272727,129.784961754943 30.7272727272727))') |
|||
) |
|||
,( |
|||
'KAGOSHIMA_7' |
|||
, ST_GeomFromEWKT('SRID=4326;POLYGON((129.836917304084 30.7272727272727,129.836917304084 30.7727272727273,129.888872853226 30.7727272727273,129.888872853226 30.7272727272727,129.836917304084 30.7272727272727))') |
|||
) |
|||
,( |
|||
'KAGOSHIMA_8' |
|||
, ST_GeomFromEWKT('SRID=4326;POLYGON((129.888872853226 30.7272727272727,129.888872853226 30.7727272727273,129.940828402367 30.7727272727273,129.940828402367 30.7272727272727,129.888872853226 30.7272727272727))') |
|||
) |
|||
,( |
|||
'KAGOSHIMA_9' |
|||
, ST_GeomFromEWKT('SRID=4326;POLYGON((129.940828402367 30.7272727272727,129.940828402367 30.7727272727273,129.992783951508 30.7727272727273,129.992783951508 30.7272727272727,129.940828402367 30.7272727272727))') |
|||
) |
|||
,( |
|||
'KAGOSHIMA_10' |
|||
, ST_GeomFromEWKT('SRID=4326;POLYGON((129.992783951508 30.7272727272727,129.992783951508 30.7727272727273,130.044739500649 30.7727272727273,130.044739500649 30.7272727272727,129.992783951508 30.7272727272727))') |
|||
) |
|||
; |
|||
|
|||
commit; |
Write
Preview
Loading…
Cancel
Save
Reference in new issue