Skip to content

Commit

Permalink
add bboxes
Browse files Browse the repository at this point in the history
  • Loading branch information
Hagellach37 committed Aug 31, 2024
1 parent 80fa2af commit cdd3f4b
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions book/02_corporate_edits.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@
" 'colombia': (-78.9909352282, -4.29818694419, -66.8763258531, 12.4373031682), \n",
" 'indonesia': (95.2930261576, -10.3599874813, 141.03385176, 5.47982086834),\n",
" 'united_arab_emirates': (51.5795186705, 22.4969475367, 56.3968473651, 26.055464179)\n",
" #'south_america': (-93.691406,-58.263287,-22.675781,14.859850), # only do this if you have a lot of RAM!\n",
" #'africa': (-24.609375,-39.095963,56.074219,36.173357) # only do this if you have a lot of RAM!\n",
"}\n",
"\n",
"selected_region = 'colombia'\n",
Expand Down Expand Up @@ -180,7 +182,11 @@
" \"mapbox\": 22,\n",
" \"Komoot\": 23,\n",
" \"AppLogica\": 24\n",
"}"
"}\n",
"\n",
"\n",
"# Define output h3 cell resolution\n",
"h3_cell_resolution = 5"
]
},
{
Expand Down Expand Up @@ -283,8 +289,8 @@
"SELECT\n",
" a.user_id,\n",
" a.valid_from,\n",
" a.h3_r5,\n",
" h3_cell_to_boundary_wkt(a.h3_r5) as geometry,\n",
" h3_cell_to_parent(a.h3_r5, {h3_cell_resolution}) as h3_cell,\n",
" h3_cell_to_boundary_wkt(h3_cell) as geometry,\n",
" CAST(changeset['hashtags'][1] AS VARCHAR) as hashtag_string,\n",
" CASE\n",
"\t\tWHEN hashtag_string ILIKE '%amap%' THEN 'amap'\n",
Expand Down Expand Up @@ -348,12 +354,12 @@
" SELECT\n",
" epoch_ms(date_trunc('month', valid_from)) as month,\n",
" corporation,\n",
" h3_r5,\n",
" h3_cell,\n",
" geometry,\n",
" count(*) as n_edits,\n",
" count(distinct user_id) as n_users\n",
" FROM osm_data\n",
" GROUP by month, corporation, h3_r5, geometry;\n",
" GROUP by month, corporation, h3_cell, geometry;\n",
"\"\"\"\n",
"\n",
"df = con.sql(map_query).df()\n",
Expand Down

0 comments on commit cdd3f4b

Please sign in to comment.