diff --git a/convert_all_solutions.ipynb b/convert_all_solutions.ipynb new file mode 100644 index 0000000..76feb31 --- /dev/null +++ b/convert_all_solutions.ipynb @@ -0,0 +1,872 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "import os\n", + "from glob import glob" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": {}, + "outputs": [], + "source": [ + "all_solutions = glob(\"**/**/solution.shp\", recursive=True)" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Collecting package metadata (current_repodata.json): done\n", + "Solving environment: failed with initial frozen solve. Retrying with flexible solve.\n", + "Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.\n", + "Collecting package metadata (repodata.json): done\n", + "Solving environment: done\n", + "\n", + "## Package Plan ##\n", + "\n", + " environment location: /home/sina/miniconda3\n", + "\n", + " added / updated specs:\n", + " - geopandas\n", + "\n", + "\n", + "The following packages will be downloaded:\n", + "\n", + " package | build\n", + " ---------------------------|-----------------\n", + " certifi-2020.6.20 | py38_0 156 KB\n", + " cffi-1.14.0 | py38h2e261b9_0 226 KB\n", + " cligj-0.5.0 | py38_0 13 KB\n", + " conda-4.8.4 | py38_0 2.8 MB\n", + " fiona-1.8.13.post1 | py38hc820daa_0 752 KB\n", + " gdal-3.0.2 | py38hbb2a789_0 1.0 MB\n", + " mkl-service-2.3.0 | py38he904b0f_0 62 KB\n", + " mkl_fft-1.1.0 | py38h23d657b_0 150 KB\n", + " mkl_random-1.1.1 | py38h0573a6f_0 341 KB\n", + " numpy-1.19.1 | py38hbc911f0_0 21 KB\n", + " numpy-base-1.19.1 | py38hfa32c7d_0 4.2 MB\n", + " pandas-1.1.1 | py38he6710b0_0 8.4 MB\n", + " pyproj-2.6.1.post1 | py38hd003209_1 406 KB\n", + " python-3.8.2 | h191fe78_0 49.6 MB\n", + " rtree-0.9.4 | py38_1 47 KB\n", + " shapely-1.7.0 | py38h98ec03d_0 398 KB\n", + " ------------------------------------------------------------\n", + " Total: 68.6 MB\n", + "\n", + "The following NEW packages will be INSTALLED:\n", + "\n", + " attrs pkgs/main/noarch::attrs-20.1.0-py_0\n", + " blas pkgs/main/linux-64::blas-1.0-mkl\n", + " bzip2 pkgs/main/linux-64::bzip2-1.0.8-h7b6447c_0\n", + " cairo pkgs/main/linux-64::cairo-1.14.12-h8948797_3\n", + " cfitsio pkgs/main/linux-64::cfitsio-3.470-hb7c8383_2\n", + " click pkgs/main/noarch::click-7.1.2-py_0\n", + " click-plugins pkgs/main/noarch::click-plugins-1.1.1-py_0\n", + " cligj pkgs/main/linux-64::cligj-0.5.0-py38_0\n", + " curl pkgs/main/linux-64::curl-7.67.0-hbc83047_0\n", + " expat pkgs/main/linux-64::expat-2.2.9-he6710b0_2\n", + " fiona pkgs/main/linux-64::fiona-1.8.13.post1-py38hc820daa_0\n", + " fontconfig pkgs/main/linux-64::fontconfig-2.13.0-h9420a91_0\n", + " freetype pkgs/main/linux-64::freetype-2.10.2-h5ab3b9f_0\n", + " freexl pkgs/main/linux-64::freexl-1.0.5-h14c3975_0\n", + " gdal pkgs/main/linux-64::gdal-3.0.2-py38hbb2a789_0\n", + " geopandas pkgs/main/noarch::geopandas-0.8.1-py_0\n", + " geos pkgs/main/linux-64::geos-3.8.0-he6710b0_0\n", + " geotiff pkgs/main/linux-64::geotiff-1.5.1-h21e8280_1\n", + " giflib pkgs/main/linux-64::giflib-5.1.4-h14c3975_1\n", + " glib pkgs/main/linux-64::glib-2.63.1-h5a9c865_0\n", + " hdf4 pkgs/main/linux-64::hdf4-4.2.13-h3ca952b_2\n", + " hdf5 pkgs/main/linux-64::hdf5-1.10.4-hb1b8bf9_0\n", + " icu pkgs/main/linux-64::icu-58.2-he6710b0_3\n", + " intel-openmp pkgs/main/linux-64::intel-openmp-2020.2-254\n", + " jpeg pkgs/main/linux-64::jpeg-9b-h024ee3a_2\n", + " json-c pkgs/main/linux-64::json-c-0.13.1-h1bed415_0\n", + " kealib pkgs/main/linux-64::kealib-1.4.7-hd0c454d_6\n", + " krb5 pkgs/main/linux-64::krb5-1.16.4-h173b8e3_0\n", + " libboost pkgs/main/linux-64::libboost-1.67.0-h46d08c1_4\n", + " libcurl pkgs/main/linux-64::libcurl-7.67.0-h20c2e04_0\n", + " libdap4 pkgs/main/linux-64::libdap4-3.19.1-h6ec2957_0\n", + " libgdal pkgs/main/linux-64::libgdal-3.0.2-h27ab9cc_0\n", + " libgfortran-ng pkgs/main/linux-64::libgfortran-ng-7.3.0-hdf63c60_0\n", + " libkml pkgs/main/linux-64::libkml-1.3.0-h590aaf7_4\n", + " libnetcdf pkgs/main/linux-64::libnetcdf-4.6.1-h11d0813_2\n", + " libpng pkgs/main/linux-64::libpng-1.6.37-hbc83047_0\n", + " libpq pkgs/main/linux-64::libpq-11.2-h20c2e04_0\n", + " libspatialindex pkgs/main/linux-64::libspatialindex-1.9.3-he6710b0_0\n", + " libspatialite pkgs/main/linux-64::libspatialite-4.3.0a-h793db0d_0\n", + " libssh2 pkgs/main/linux-64::libssh2-1.9.0-h1ba5d50_1\n", + " libtiff pkgs/main/linux-64::libtiff-4.1.0-h2733197_0\n", + " libuuid pkgs/main/linux-64::libuuid-1.0.3-h1bed415_2\n", + " libxcb pkgs/main/linux-64::libxcb-1.14-h7b6447c_0\n", + " libxml2 pkgs/main/linux-64::libxml2-2.9.10-he19cac6_1\n", + " lz4-c pkgs/main/linux-64::lz4-c-1.8.1.2-h14c3975_0\n", + " mkl pkgs/main/linux-64::mkl-2020.2-256\n", + " mkl-service pkgs/main/linux-64::mkl-service-2.3.0-py38he904b0f_0\n", + " mkl_fft pkgs/main/linux-64::mkl_fft-1.1.0-py38h23d657b_0\n", + " mkl_random pkgs/main/linux-64::mkl_random-1.1.1-py38h0573a6f_0\n", + " munch pkgs/main/noarch::munch-2.5.0-py_0\n", + " numpy pkgs/main/linux-64::numpy-1.19.1-py38hbc911f0_0\n", + " numpy-base pkgs/main/linux-64::numpy-base-1.19.1-py38hfa32c7d_0\n", + " openjpeg pkgs/main/linux-64::openjpeg-2.3.0-h05c96fa_1\n", + " pandas pkgs/main/linux-64::pandas-1.1.1-py38he6710b0_0\n", + " pcre pkgs/main/linux-64::pcre-8.44-he6710b0_0\n", + " pixman pkgs/main/linux-64::pixman-0.40.0-h7b6447c_0\n", + " poppler pkgs/main/linux-64::poppler-0.65.0-h581218d_1\n", + " poppler-data pkgs/main/linux-64::poppler-data-0.4.9-0\n", + " postgresql pkgs/main/linux-64::postgresql-11.2-h20c2e04_0\n", + " proj pkgs/main/linux-64::proj-6.2.1-haa6030c_0\n", + " pyproj pkgs/main/linux-64::pyproj-2.6.1.post1-py38hd003209_1\n", + " python-dateutil pkgs/main/noarch::python-dateutil-2.8.1-py_0\n", + " pytz pkgs/main/noarch::pytz-2020.1-py_0\n", + " rtree pkgs/main/linux-64::rtree-0.9.4-py38_1\n", + " shapely pkgs/main/linux-64::shapely-1.7.0-py38h98ec03d_0\n", + " tbb pkgs/main/linux-64::tbb-2018.0.5-h6bb024c_0\n", + " tiledb pkgs/main/linux-64::tiledb-1.6.3-h1fb8f14_0\n", + " xerces-c pkgs/main/linux-64::xerces-c-3.2.2-h780794e_0\n", + " zstd pkgs/main/linux-64::zstd-1.3.7-h0b5b093_0\n", + "\n", + "The following packages will be UPDATED:\n", + "\n", + " ca-certificates 2020.1.1-0 --> 2020.7.22-0\n", + " certifi 2020.4.5.1-py38_0 --> 2020.6.20-py38_0\n", + " conda 4.8.3-py38_0 --> 4.8.4-py38_0\n", + "\n", + "The following packages will be DOWNGRADED:\n", + "\n", + " cffi 1.14.0-py38he30daa8_1 --> 1.14.0-py38h2e261b9_0\n", + " libffi 3.3-he6710b0_1 --> 3.2.1-hd88cf55_4\n", + " python 3.8.3-hcff3b4d_0 --> 3.8.2-h191fe78_0\n", + " readline 8.0-h7b6447c_0 --> 7.0-h7b6447c_5\n", + "\n", + "\n", + "\n", + "Downloading and Extracting Packages\n", + "rtree-0.9.4 | 47 KB | ##################################### | 100% \n", + "mkl_fft-1.1.0 | 150 KB | ##################################### | 100% \n", + "cffi-1.14.0 | 226 KB | ##################################### | 100% \n", + "numpy-base-1.19.1 | 4.2 MB | ##################################### | 100% \n", + "pandas-1.1.1 | 8.4 MB | ##################################### | 100% \n", + "mkl_random-1.1.1 | 341 KB | ##################################### | 100% \n", + "gdal-3.0.2 | 1.0 MB | ##################################### | 100% \n", + "python-3.8.2 | 49.6 MB | ##################################### | 100% \n", + "numpy-1.19.1 | 21 KB | ##################################### | 100% \n", + "fiona-1.8.13.post1 | 752 KB | ##################################### | 100% \n", + "certifi-2020.6.20 | 156 KB | ##################################### | 100% \n", + "mkl-service-2.3.0 | 62 KB | ##################################### | 100% \n", + "cligj-0.5.0 | 13 KB | ##################################### | 100% \n", + "conda-4.8.4 | 2.8 MB | ##################################### | 100% \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "pyproj-2.6.1.post1 | 406 KB | ##################################### | 100% \n", + "shapely-1.7.0 | 398 KB | ##################################### | 100% \n", + "Preparing transaction: done\n", + "Verifying transaction: done\n", + "Executing transaction: done\n" + ] + } + ], + "source": [ + "!conda install geopandas -y" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "North Dakota/output\n", + " id geometry\n", + "0 0 LINESTRING (-100.78765 46.80712, -100.78765 46...\n", + "1 1 LINESTRING (-100.75321 46.81983, -100.75321 46...\n", + "2 2 LINESTRING (-100.44593 48.82124, -100.44593 48...\n", + "3 3 LINESTRING (-97.20862 46.89672, -97.20862 46.8...\n", + "4 4 LINESTRING (-96.79415 46.86518, -96.79415 46.8...\n", + "... ... ...\n", + "279327 279327 LINESTRING (-99.35604 48.48666, -99.35836 48.4...\n", + "279328 279328 LINESTRING (-99.36769 48.48667, -99.37080 48.4...\n", + "279329 279329 LINESTRING (-99.36687 48.48667, -99.36769 48.4...\n", + "279330 279330 LINESTRING (-99.35836 48.48665, -99.36255 48.4...\n", + "279331 279331 LINESTRING (-99.36255 48.48666, -99.36687 48.4...\n", + "\n", + "[279332 rows x 2 columns]\n", + "./North Dakota/output\n", + "Nevada/output\n", + " id geometry\n", + "0 0 LINESTRING (-115.32951 36.29106, -115.32951 36...\n", + "1 1 LINESTRING (-114.09841 36.79197, -114.09841 36...\n", + "2 2 LINESTRING (-115.01772 36.06770, -115.01772 36...\n", + "3 3 LINESTRING (-114.11311 36.83288, -114.11311 36...\n", + "4 4 LINESTRING (-115.28298 36.14717, -115.28298 36...\n", + "... ... ...\n", + "1493682 1493682 LINESTRING (-114.75769 41.45914, -114.75976 41...\n", + "1493683 1493683 LINESTRING (-114.75976 41.47040, -114.75982 41...\n", + "1493684 1493684 LINESTRING (-114.76031 41.47342, -114.76056 41...\n", + "1493685 1493685 LINESTRING (-114.76012 41.47241, -114.76031 41...\n", + "1493686 1493686 LINESTRING (-114.75982 41.47073, -114.76012 41...\n", + "\n", + "[1493687 rows x 2 columns]\n", + "./Nevada/output\n", + "Minnesota/output\n", + " id geometry\n", + "0 0 LINESTRING (-93.26958 44.94278, -93.26958 44.9...\n", + "1 1 LINESTRING (-93.38712 44.82072, -93.38712 44.8...\n", + "2 2 LINESTRING (-93.28498 44.93894, -93.28498 44.9...\n", + "3 3 LINESTRING (-96.73227 46.85851, -96.73227 46.8...\n", + "4 4 LINESTRING (-93.16996 44.68481, -93.16996 44.6...\n", + "... ... ...\n", + "3103281 3103281 LINESTRING (-94.53194 43.83293, -94.53726 43.8...\n", + "3103282 3103282 LINESTRING (-94.57228 43.83324, -94.59226 43.8...\n", + "3103283 3103283 LINESTRING (-94.53726 43.83295, -94.54234 43.8...\n", + "3103284 3103284 LINESTRING (-94.54234 43.83299, -94.55229 43.8...\n", + "3103285 3103285 LINESTRING (-94.55229 43.83305, -94.57228 43.8...\n", + "\n", + "[3103286 rows x 2 columns]\n", + "./Minnesota/output\n", + "Idaho/output\n", + " id geometry\n", + "0 0 LINESTRING (-116.25782 43.72447, -116.25782 43...\n", + "1 1 LINESTRING (-116.32997 43.62634, -116.32997 43...\n", + "2 2 LINESTRING (-112.13531 43.36693, -112.13531 43...\n", + "3 3 LINESTRING (-116.33196 43.60020, -116.33196 43...\n", + "4 4 LINESTRING (-116.58469 43.57787, -116.58469 43...\n", + "... ... ...\n", + "802402 802402 LINESTRING (-116.30738 45.09247, -116.30743 45...\n", + "802403 802403 LINESTRING (-116.30766 45.09636, -116.30769 45...\n", + "802404 802404 LINESTRING (-116.30759 45.09526, -116.30766 45...\n", + "802405 802405 LINESTRING (-116.30743 45.09303, -116.30754 45...\n", + "802406 802406 LINESTRING (-116.30754 45.09466, -116.30759 45...\n", + "\n", + "[802407 rows x 2 columns]\n", + "./Idaho/output\n", + "New Hampshire/output\n", + " id geometry\n", + "0 0 LINESTRING (-71.76093 43.62882, -71.76093 43.6...\n", + "1 1 LINESTRING (-72.16814 43.59314, -72.16814 43.5...\n", + "2 2 LINESTRING (-71.43878 42.99024, -71.43878 42.9...\n", + "3 3 LINESTRING (-71.43415 42.74790, -71.43415 42.7...\n", + "4 4 LINESTRING (-72.08054 43.38693, -72.08054 43.3...\n", + "... ... ...\n", + "1569574 1569574 LINESTRING (-71.26779 44.01060, -71.26753 44.0...\n", + "1569575 1569575 LINESTRING (-71.26753 44.01070, -71.26718 44.0...\n", + "1569576 1569576 LINESTRING (-71.26595 44.01087, -71.26538 44.0...\n", + "1569577 1569577 LINESTRING (-71.26718 44.01077, -71.26682 44.0...\n", + "1569578 1569578 LINESTRING (-71.26682 44.01081, -71.26595 44.0...\n", + "\n", + "[1569579 rows x 2 columns]\n", + "./New Hampshire/output\n", + "Vermont/output\n", + " id geometry\n", + "0 0 LINESTRING (-72.21194 44.21298, -72.21194 44.2...\n", + "1 1 LINESTRING (-73.19406 44.48605, -73.19406 44.4...\n", + "2 2 LINESTRING (-73.19523 44.48681, -73.19523 44.4...\n", + "3 3 LINESTRING (-72.22260 44.78771, -72.22259 44.7...\n", + "4 4 LINESTRING (-73.19491 44.48563, -73.19491 44.4...\n", + "... ... ...\n", + "1102838 1102838 LINESTRING (-71.60281 44.69612, -71.60291 44.6...\n", + "1102839 1102839 LINESTRING (-71.60268 44.69593, -71.60281 44.6...\n", + "1102840 1102840 LINESTRING (-71.60254 44.69576, -71.60268 44.6...\n", + "1102841 1102841 LINESTRING (-71.60200 44.69519, -71.60240 44.6...\n", + "1102842 1102842 LINESTRING (-71.60240 44.69560, -71.60254 44.6...\n", + "\n", + "[1102843 rows x 2 columns]\n", + "./Vermont/output\n", + "Utah/output\n", + " id geometry\n", + "0 0 LINESTRING (-111.88471 40.77172, -111.88471 40...\n", + "1 1 LINESTRING (-111.89177 40.77364, -111.89177 40...\n", + "2 2 LINESTRING (-111.91140 40.67585, -111.91140 40...\n", + "3 3 LINESTRING (-111.96690 40.68848, -111.96690 40...\n", + "4 4 LINESTRING (-111.88454 40.62077, -111.88454 40...\n", + "... ... ...\n", + "1360333 1360333 LINESTRING (-113.13441 40.72600, -113.13268 40...\n", + "1360334 1360334 LINESTRING (-113.12582 40.72821, -113.12217 40...\n", + "1360335 1360335 LINESTRING (-113.13268 40.72635, -113.13095 40...\n", + "1360336 1360336 LINESTRING (-113.13095 40.72677, -113.12924 40...\n", + "1360337 1360337 LINESTRING (-113.12924 40.72724, -113.12582 40...\n", + "\n", + "[1360338 rows x 2 columns]\n", + "./Utah/output\n", + "Alabama/output\n", + " id geometry\n", + "0 0 LINESTRING (-86.95654 34.58802, -86.95654 34.5...\n", + "1 1 LINESTRING (-86.71707 34.75891, -86.71707 34.7...\n", + "2 2 LINESTRING (-86.03872 33.41956, -86.03872 33.4...\n", + "3 3 LINESTRING (-86.57041 34.63538, -86.57041 34.6...\n", + "4 4 LINESTRING (-86.44710 32.46494, -86.44710 32.4...\n", + "... ... ...\n", + "4159384 4159384 LINESTRING (-87.59048 32.71297, -87.59004 32.7...\n", + "4159385 4159385 LINESTRING (-87.58882 32.71404, -87.58858 32.7...\n", + "4159386 4159386 LINESTRING (-87.58907 32.71393, -87.58882 32.7...\n", + "4159387 4159387 LINESTRING (-87.59004 32.71333, -87.58957 32.7...\n", + "4159388 4159388 LINESTRING (-87.58957 32.71365, -87.58907 32.7...\n", + "\n", + "[4159389 rows x 2 columns]\n", + "./Alabama/output\n", + "Mississippi/output\n", + " id geometry\n", + "0 0 LINESTRING (-88.89678 30.47255, -88.89679 30.4...\n", + "1 1 LINESTRING (-88.92254 30.42780, -88.92255 30.4...\n", + "2 2 LINESTRING (-89.57611 30.84988, -89.57611 30.8...\n", + "3 3 LINESTRING (-89.35266 30.30371, -89.35266 30.3...\n", + "4 4 LINESTRING (-89.59973 30.24934, -89.59973 30.2...\n", + "... ... ...\n", + "227924 227924 LINESTRING (-89.44316 30.99605, -89.44303 30.9...\n", + "227925 227925 LINESTRING (-89.44286 30.99717, -89.44281 30.9...\n", + "227926 227926 LINESTRING (-89.44303 30.99640, -89.44297 30.9...\n", + "227927 227927 LINESTRING (-89.44290 30.99698, -89.44286 30.9...\n", + "227928 227928 LINESTRING (-89.44297 30.99662, -89.44290 30.9...\n", + "\n", + "[227929 rows x 2 columns]\n", + "./Mississippi/output\n", + "Maine/output\n", + " id geometry\n", + "0 0 LINESTRING (-68.66036 45.24279, -68.66036 45.2...\n", + "1 1 LINESTRING (-70.61192 43.17050, -70.61192 43.1...\n", + "2 2 LINESTRING (-70.16451 44.09676, -70.16451 44.0...\n", + "3 3 LINESTRING (-67.27587 45.18534, -67.27587 45.1...\n", + "4 4 LINESTRING (-69.88175 44.80194, -69.88175 44.8...\n", + "... ... ...\n", + "1252223 1252223 LINESTRING (-67.61013 45.48108, -67.61010 45.4...\n", + "1252224 1252224 LINESTRING (-67.61091 45.47550, -67.60981 45.4...\n", + "1252225 1252225 LINESTRING (-67.60981 45.47772, -67.60958 45.4...\n", + "1252226 1252226 LINESTRING (-67.60958 45.47813, -67.60945 45.4...\n", + "1252227 1252227 LINESTRING (-67.60945 45.47870, -67.61013 45.4...\n", + "\n", + "[1252228 rows x 2 columns]\n", + "./Maine/output\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Iowa/output\n", + " id geometry\n", + "0 0 LINESTRING (-93.70172 41.66765, -93.70172 41.6...\n", + "1 1 LINESTRING (-93.65139 42.02339, -93.65139 42.0...\n", + "2 2 LINESTRING (-93.65199 42.02339, -93.65199 42.0...\n", + "3 3 LINESTRING (-94.09837 41.84113, -94.09837 41.8...\n", + "4 4 LINESTRING (-96.41592 42.49755, -96.41592 42.4...\n", + "... ... ...\n", + "2299015 2299015 LINESTRING (-95.76466 40.77368, -95.76224 40.7...\n", + "2299016 2299016 LINESTRING (-95.76014 40.77365, -95.75745 40.7...\n", + "2299017 2299017 LINESTRING (-92.57234 42.30412, -92.57242 42.3...\n", + "2299018 2299018 LINESTRING (-95.76224 40.77367, -95.76115 40.7...\n", + "2299019 2299019 LINESTRING (-95.76115 40.77364, -95.76014 40.7...\n", + "\n", + "[2299020 rows x 2 columns]\n", + "./Iowa/output\n", + "Indiana/output\n", + " id geometry\n", + "0 0 LINESTRING (-86.03761 39.76657, -86.03761 39.7...\n", + "1 1 LINESTRING (-86.07072 39.68531, -86.07072 39.6...\n", + "2 2 LINESTRING (-86.06905 39.78860, -86.06905 39.7...\n", + "3 3 LINESTRING (-85.65567 40.06711, -85.65567 40.0...\n", + "4 4 LINESTRING (-85.74711 38.36466, -85.74711 38.3...\n", + "... ... ...\n", + "5215473 5215473 LINESTRING (-86.62245 38.14703, -86.62313 38.1...\n", + "5215474 5215474 LINESTRING (-86.62445 38.14426, -86.62522 38.1...\n", + "5215475 5215475 LINESTRING (-86.62411 38.14501, -86.62445 38.1...\n", + "5215476 5215476 LINESTRING (-86.62313 38.14592, -86.62396 38.1...\n", + "5215477 5215477 LINESTRING (-86.62396 38.14529, -86.62411 38.1...\n", + "\n", + "[5215478 rows x 2 columns]\n", + "./Indiana/output\n", + "Wyoming/output\n", + " id geometry\n", + "0 0 LINESTRING (-108.35270 43.05741, -108.35270 43...\n", + "1 1 LINESTRING (-104.95466 42.05464, -104.95466 42...\n", + "2 2 LINESTRING (-106.70411 44.34962, -106.70411 44...\n", + "3 3 LINESTRING (-110.83500 43.58173, -110.83500 43...\n", + "4 4 LINESTRING (-108.77639 44.75859, -108.77639 44...\n", + "... ... ...\n", + "517149 517149 LINESTRING (-109.38268 44.74257, -109.38236 44...\n", + "517150 517150 LINESTRING (-109.38299 44.74391, -109.38299 44...\n", + "517151 517151 LINESTRING (-109.38282 44.74288, -109.38268 44...\n", + "517152 517152 LINESTRING (-109.38299 44.74354, -109.38293 44...\n", + "517153 517153 LINESTRING (-109.38293 44.74309, -109.38282 44...\n", + "\n", + "[517154 rows x 2 columns]\n", + "./Wyoming/output\n", + "Delaware/output\n", + " id geometry\n", + "0 0 LINESTRING (-75.53898 39.13335, -75.53898 39.1...\n", + "1 1 LINESTRING (-75.56649 39.66293, -75.56649 39.6...\n", + "2 2 LINESTRING (-75.18757 38.62402, -75.18757 38.6...\n", + "3 3 LINESTRING (-75.05427 38.45763, -75.05427 38.4...\n", + "4 4 LINESTRING (-75.09849 38.70700, -75.09849 38.7...\n", + "... ... ...\n", + "651821 651821 LINESTRING (-75.26835 38.85517, -75.26686 38.8...\n", + "651822 651822 LINESTRING (-75.26633 38.85474, -75.26613 38.8...\n", + "651823 651823 LINESTRING (-75.26686 38.85484, -75.26671 38.8...\n", + "651824 651824 LINESTRING (-75.26658 38.85478, -75.26633 38.8...\n", + "651825 651825 LINESTRING (-75.26671 38.85481, -75.26658 38.8...\n", + "\n", + "[651826 rows x 2 columns]\n", + "./Delaware/output\n", + "Oklahoma/output\n", + " id geometry\n", + "0 0 LINESTRING (-97.11340 34.18314, -97.11340 34.1...\n", + "1 1 LINESTRING (-97.52687 35.31447, -97.52687 35.3...\n", + "2 2 LINESTRING (-97.11340 34.18381, -97.11340 34.1...\n", + "3 3 LINESTRING (-97.56965 35.35627, -97.56965 35.3...\n", + "4 4 LINESTRING (-97.56272 35.36075, -97.56272 35.3...\n", + "... ... ...\n", + "763265 763265 LINESTRING (-96.62269 36.11836, -96.62193 36.1...\n", + "763266 763266 LINESTRING (-96.62620 36.11730, -96.62541 36.1...\n", + "763267 763267 LINESTRING (-96.62353 36.11810, -96.62269 36.1...\n", + "763268 763268 LINESTRING (-96.62541 36.11750, -96.62472 36.1...\n", + "763269 763269 LINESTRING (-96.62472 36.11771, -96.62353 36.1...\n", + "\n", + "[763270 rows x 2 columns]\n", + "./Oklahoma/output\n", + "Nebraska/output\n", + " id geometry\n", + "0 0 LINESTRING (-96.67879 40.76411, -96.67879 40.7...\n", + "1 1 LINESTRING (-99.08936 40.69208, -99.08936 40.6...\n", + "2 2 LINESTRING (-96.74457 40.81618, -96.74457 40.8...\n", + "3 3 LINESTRING (-96.06868 41.28371, -96.06868 41.2...\n", + "4 4 LINESTRING (-96.68687 40.78345, -96.68687 40.7...\n", + "... ... ...\n", + "1648251 1648251 LINESTRING (-103.91411 42.73684, -103.91638 42...\n", + "1648252 1648252 LINESTRING (-100.29752 42.95442, -100.29756 42...\n", + "1648253 1648253 LINESTRING (-100.29785 42.96869, -100.29752 42...\n", + "1648254 1648254 LINESTRING (-103.91371 42.73668, -103.91411 42...\n", + "1648255 1648255 LINESTRING (-103.91042 42.73557, -103.91371 42...\n", + "\n", + "[1648256 rows x 2 columns]\n", + "./Nebraska/output\n", + "Colorado/output\n", + " id geometry\n", + "0 0 LINESTRING (-104.98053 39.73205, -104.98053 39...\n", + "1 1 LINESTRING (-104.72719 40.39283, -104.72719 40...\n", + "2 2 LINESTRING (-104.93840 39.73378, -104.93840 39...\n", + "3 3 LINESTRING (-104.98624 39.69535, -104.98624 39...\n", + "4 4 LINESTRING (-104.77248 39.70339, -104.77248 39...\n", + "... ... ...\n", + "3889308 3889308 LINESTRING (-105.22054 37.60903, -105.22021 37...\n", + "3889309 3889309 LINESTRING (-105.22021 37.60899, -105.21987 37...\n", + "3889310 3889310 LINESTRING (-105.21987 37.60911, -105.21977 37...\n", + "3889311 3889311 LINESTRING (-105.21977 37.60901, -105.21966 37...\n", + "3889312 3889312 LINESTRING (-105.22573 37.60613, -105.21966 37...\n", + "\n", + "[3889313 rows x 2 columns]\n", + "./Colorado/output\n", + "Connecticut/output\n", + " id geometry\n", + "0 0 LINESTRING (-72.96452 41.25088, -72.96452 41.2...\n", + "1 1 LINESTRING (-73.49454 41.14272, -73.49454 41.1...\n", + "2 2 LINESTRING (-72.86157 41.24767, -72.86157 41.2...\n", + "3 3 LINESTRING (-72.88315 41.30108, -72.88315 41.3...\n", + "4 4 LINESTRING (-72.70775 41.72900, -72.70775 41.7...\n", + "... ... ...\n", + "1643657 1643657 LINESTRING (-72.92567 41.82689, -72.92552 41.8...\n", + "1643658 1643658 LINESTRING (-72.92568 41.82692, -72.92567 41.8...\n", + "1643659 1643659 LINESTRING (-72.92580 41.82768, -72.92568 41.8...\n", + "1643660 1643660 LINESTRING (-72.92607 41.83036, -72.92589 41.8...\n", + "1643661 1643661 LINESTRING (-72.92589 41.82862, -72.92580 41.8...\n", + "\n", + "[1643662 rows x 2 columns]\n", + "./Connecticut/output\n", + "Montana/output\n", + " id geometry\n", + "0 0 LINESTRING (-114.30912 48.19887, -114.30912 48...\n", + "1 1 LINESTRING (-111.05846 45.67185, -111.05846 45...\n", + "2 2 LINESTRING (-113.01060 48.55382, -113.01060 48...\n", + "3 3 LINESTRING (-108.59469 45.75608, -108.59469 45...\n", + "4 4 LINESTRING (-104.27104 46.35780, -104.27104 46...\n", + "... ... ...\n", + "1074615 1074615 LINESTRING (-106.14001 47.32557, -106.12870 47...\n", + "1074616 1074616 LINESTRING (-106.12870 47.32555, -106.12555 47...\n", + "1074617 1074617 LINESTRING (-106.10192 47.32552, -106.08232 47...\n", + "1074618 1074618 LINESTRING (-106.12555 47.32555, -106.11767 47...\n", + "1074619 1074619 LINESTRING (-106.11767 47.32554, -106.10192 47...\n", + "\n", + "[1074620 rows x 2 columns]\n", + "./Montana/output\n", + "Rhode Island/output\n", + " id geometry\n", + "0 0 LINESTRING (-71.50238 42.00082, -71.50238 42.0...\n", + "1 1 LINESTRING (-71.42827 41.83404, -71.42827 41.8...\n", + "2 2 LINESTRING (-71.41248 41.80545, -71.41248 41.8...\n", + "3 3 LINESTRING (-71.40089 41.88067, -71.40089 41.8...\n", + "4 4 LINESTRING (-71.42459 41.83271, -71.42459 41.8...\n", + "... ... ...\n", + "719725 719725 LINESTRING (-71.24428 41.67657, -71.24468 41.6...\n", + "719726 719726 LINESTRING (-71.49865 41.37943, -71.49777 41.3...\n", + "719727 719727 LINESTRING (-71.50199 41.37998, -71.49970 41.3...\n", + "719728 719728 LINESTRING (-71.49918 41.37951, -71.49865 41.3...\n", + "719729 719729 LINESTRING (-71.49970 41.37960, -71.49918 41.3...\n", + "\n", + "[719730 rows x 2 columns]\n", + "./Rhode Island/output\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "South Dakota/output\n", + " id geometry\n", + "0 0 LINESTRING (-98.40541 43.42582, -98.40541 43.4...\n", + "1 1 LINESTRING (-98.48182 45.46414, -98.48181 45.4...\n", + "2 2 LINESTRING (-98.16372 43.26417, -98.16372 43.2...\n", + "3 3 LINESTRING (-97.12141 44.00445, -97.12141 44.0...\n", + "4 4 LINESTRING (-97.98964 43.72752, -97.98964 43.7...\n", + "... ... ...\n", + "306881 306881 LINESTRING (-103.90135 45.09355, -103.90205 45...\n", + "306882 306882 LINESTRING (-103.90511 45.12053, -103.90579 45...\n", + "306883 306883 LINESTRING (-103.90205 45.09837, -103.90217 45...\n", + "306884 306884 LINESTRING (-103.90417 45.11388, -103.90511 45...\n", + "306885 306885 LINESTRING (-103.90217 45.09982, -103.90366 45...\n", + "\n", + "[306886 rows x 2 columns]\n", + "./South Dakota/output\n", + "Kentucky/output\n", + " id geometry\n", + "0 0 LINESTRING (-84.49720 38.04520, -84.49720 38.0...\n", + "1 1 LINESTRING (-84.47627 39.05906, -84.47627 39.0...\n", + "2 2 LINESTRING (-84.49069 38.03830, -84.49069 38.0...\n", + "3 3 LINESTRING (-84.51867 38.03117, -84.51867 38.0...\n", + "4 4 LINESTRING (-84.50336 38.03177, -84.50336 38.0...\n", + "... ... ...\n", + "1409610 1409610 LINESTRING (-88.13146 37.32559, -88.13123 37.3...\n", + "1409611 1409611 LINESTRING (-88.13123 37.32564, -88.13099 37.3...\n", + "1409612 1409612 LINESTRING (-88.12636 37.32620, -88.12126 37.3...\n", + "1409613 1409613 LINESTRING (-88.13099 37.32567, -88.12826 37.3...\n", + "1409614 1409614 LINESTRING (-88.12826 37.32599, -88.12636 37.3...\n", + "\n", + "[1409615 rows x 2 columns]\n", + "./Kentucky/output\n", + "Hawaii/output\n", + " id geometry\n", + "0 0 LINESTRING (-158.00255 21.45292, -158.00255 21...\n", + "1 1 LINESTRING (-158.17664 21.42146, -158.17664 21...\n", + "2 2 LINESTRING (-157.74661 21.39663, -157.74661 21...\n", + "3 3 LINESTRING (-157.81046 21.28196, -157.81046 21...\n", + "4 4 LINESTRING (-157.91109 21.38038, -157.91109 21...\n", + "... ... ...\n", + "158466 158466 LINESTRING (-157.66105 21.30028, -157.66077 21...\n", + "158467 158467 LINESTRING (-157.66242 21.29878, -157.66222 21...\n", + "158468 158468 LINESTRING (-157.66129 21.30005, -157.66105 21...\n", + "158469 158469 LINESTRING (-157.66222 21.29907, -157.66194 21...\n", + "158470 158470 LINESTRING (-157.66194 21.29937, -157.66129 21...\n", + "\n", + "[158471 rows x 2 columns]\n", + "./Hawaii/output\n", + "South Carolina/output\n", + " id geometry\n", + "0 0 LINESTRING (-80.17395 33.03835, -80.17395 33.0...\n", + "1 1 LINESTRING (-81.79524 33.52647, -81.79524 33.5...\n", + "2 2 LINESTRING (-81.03200 34.97137, -81.03200 34.9...\n", + "3 3 LINESTRING (-80.17776 33.03628, -80.17776 33.0...\n", + "4 4 LINESTRING (-80.51567 32.89073, -80.51567 32.8...\n", + "... ... ...\n", + "3264625 3264625 LINESTRING (-83.02586 34.99883, -83.02580 34.9...\n", + "3264626 3264626 LINESTRING (-83.02509 35.00374, -83.02542 35.0...\n", + "3264627 3264627 LINESTRING (-83.02508 35.00304, -83.02509 35.0...\n", + "3264628 3264628 LINESTRING (-83.02509 35.00297, -83.02508 35.0...\n", + "3264629 3264629 LINESTRING (-83.02580 34.99967, -83.02509 35.0...\n", + "\n", + "[3264630 rows x 2 columns]\n", + "./South Carolina/output\n", + "New Mexico/output\n", + " id geometry\n", + "0 0 LINESTRING (-108.20083 36.75349, -108.20083 36...\n", + "1 1 LINESTRING (-106.65749 35.12585, -106.65749 35...\n", + "2 2 LINESTRING (-103.31742 33.25802, -103.31742 33...\n", + "3 3 LINESTRING (-106.80796 35.22172, -106.80796 35...\n", + "4 4 LINESTRING (-105.59064 32.93276, -105.59064 32...\n", + "... ... ...\n", + "1079755 1079755 LINESTRING (-104.59676 32.31423, -104.59663 32...\n", + "1079756 1079756 LINESTRING (-104.59622 32.31697, -104.59597 32...\n", + "1079757 1079757 LINESTRING (-104.59663 32.31491, -104.59650 32...\n", + "1079758 1079758 LINESTRING (-104.59639 32.31610, -104.59622 32...\n", + "1079759 1079759 LINESTRING (-104.59650 32.31551, -104.59639 32...\n", + "\n", + "[1079760 rows x 2 columns]\n", + "./New Mexico/output\n", + "Kansas/output\n", + " id geometry\n", + "0 0 LINESTRING (-100.03541 37.78395, -100.03541 37...\n", + "1 1 LINESTRING (-95.76639 38.99203, -95.76639 38.9...\n", + "2 2 LINESTRING (-94.94557 38.49733, -94.94557 38.4...\n", + "3 3 LINESTRING (-94.63293 38.94716, -94.63293 38.9...\n", + "4 4 LINESTRING (-97.42627 37.69552, -97.42627 37.6...\n", + "... ... ...\n", + "1916355 1916355 LINESTRING (-101.53149 38.47412, -101.52986 38...\n", + "1916356 1916356 LINESTRING (-101.52986 38.47439, -101.52590 38...\n", + "1916357 1916357 LINESTRING (-101.51183 38.47823, -101.50833 38...\n", + "1916358 1916358 LINESTRING (-101.51314 38.47792, -101.51183 38...\n", + "1916359 1916359 LINESTRING (-101.51930 38.47650, -101.51314 38...\n", + "\n", + "[1916360 rows x 2 columns]\n", + "./Kansas/output\n", + "Alaska/output\n", + " id geometry\n", + "0 0 LINESTRING (-149.95283 61.18765, -149.95283 61...\n", + "1 1 LINESTRING (-149.84139 61.22247, -149.84139 61...\n", + "2 2 LINESTRING (-151.07228 60.48709, -151.07228 60...\n", + "3 3 LINESTRING (-151.30148 60.57870, -151.30148 60...\n", + "4 4 LINESTRING (-149.76245 61.20269, -149.76245 61...\n", + "... ... ...\n", + "343155 343155 LINESTRING (-148.89960 63.75465, -148.89949 63...\n", + "343156 343156 LINESTRING (-148.89963 63.75443, -148.89960 63...\n", + "343157 343157 LINESTRING (-148.89963 63.75414, -148.89963 63...\n", + "343158 343158 LINESTRING (-148.89958 63.75392, -148.89963 63...\n", + "343159 343159 LINESTRING (-148.89902 63.75225, -148.89958 63...\n", + "\n", + "[343160 rows x 2 columns]\n", + "./Alaska/output\n", + "West Virginia/output\n", + " id geometry\n", + "0 0 LINESTRING (-79.96188 39.65953, -79.96188 39.6...\n", + "1 1 LINESTRING (-81.63467 38.35015, -81.63467 38.3...\n", + "2 2 LINESTRING (-82.15798 38.19669, -82.15798 38.1...\n", + "3 3 LINESTRING (-79.94975 39.62513, -79.94975 39.6...\n", + "4 4 LINESTRING (-81.03718 37.65520, -81.03718 37.6...\n", + "... ... ...\n", + "2202655 2202655 LINESTRING (-81.65778 37.37860, -81.65876 37.3...\n", + "2202656 2202656 LINESTRING (-81.65735 37.37826, -81.65778 37.3...\n", + "2202657 2202657 LINESTRING (-81.65554 37.37691, -81.65706 37.3...\n", + "2202658 2202658 LINESTRING (-81.65706 37.37709, -81.65721 37.3...\n", + "2202659 2202659 LINESTRING (-81.65721 37.37725, -81.65735 37.3...\n", + "\n", + "[2202660 rows x 2 columns]\n", + "./West Virginia/output\n", + "Louisiana/output\n", + " id geometry\n", + "0 0 LINESTRING (-91.49246 32.46155, -91.49246 32.4...\n", + "1 1 LINESTRING (-90.05478 29.99312, -90.05478 29.9...\n", + "2 2 LINESTRING (-90.11580 29.92860, -90.11580 29.9...\n", + "3 3 LINESTRING (-93.04750 32.53299, -93.04750 32.5...\n", + "4 4 LINESTRING (-91.17640 30.42282, -91.17640 30.4...\n", + "... ... ...\n", + "1656154 1656154 LINESTRING (-92.16772 32.51053, -92.16674 32.5...\n", + "1656155 1656155 LINESTRING (-92.16409 32.50955, -92.16323 32.5...\n", + "1656156 1656156 LINESTRING (-92.16674 32.51034, -92.16580 32.5...\n", + "1656157 1656157 LINESTRING (-92.16490 32.50982, -92.16409 32.5...\n", + "1656158 1656158 LINESTRING (-92.16580 32.51010, -92.16490 32.5...\n", + "\n", + "[1656159 rows x 2 columns]\n", + "./Louisiana/output\n", + "Traceback (most recent call last):\n", + " File \"/home/sina/miniconda3/lib/python3.8/site-packages/pandas/io/formats/csvs.py\", line 206, in save\n", + " self._save()\n", + " File \"/home/sina/miniconda3/lib/python3.8/site-packages/pandas/io/formats/csvs.py\", line 328, in _save\n", + " self._save_chunk(start_i, end_i)\n", + " File \"/home/sina/miniconda3/lib/python3.8/site-packages/pandas/io/formats/csvs.py\", line 362, in _save_chunk\n", + " libwriters.write_csv_rows(self.data, ix, self.nlevels, self.cols, self.writer)\n", + " File \"pandas/_libs/writers.pyx\", line 53, in pandas._libs.writers.write_csv_rows\n", + "OSError: [Errno 28] No space left on device\n", + "\n", + "During handling of the above exception, another exception occurred:\n", + "\n", + "OSError: [Errno 28] No space left on device\n", + "\n", + "During handling of the above exception, another exception occurred:\n", + "\n", + "Traceback (most recent call last):\n", + " File \"scripts/convert.py\", line 21, in \n", + " main()\n", + " File \"scripts/convert.py\", line 18, in main\n", + " data.to_csv(os.path.join(output, \"network.csv\"))\n", + " File \"/home/sina/miniconda3/lib/python3.8/site-packages/pandas/core/generic.py\", line 3167, in to_csv\n", + " formatter.save()\n", + " File \"/home/sina/miniconda3/lib/python3.8/site-packages/pandas/io/formats/csvs.py\", line 227, in save\n", + " f.close()\n", + "OSError: [Errno 28] No space left on device\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "North Dakota/output\n", + " id geometry\n", + "0 0 LINESTRING (-100.78765 46.80712, -100.78765 46...\n", + "1 1 LINESTRING (-100.75321 46.81983, -100.75321 46...\n", + "2 2 LINESTRING (-100.44593 48.82124, -100.44593 48...\n", + "3 3 LINESTRING (-97.20862 46.89672, -97.20862 46.8...\n", + "4 4 LINESTRING (-96.79415 46.86518, -96.79415 46.8...\n", + "... ... ...\n", + "279327 279327 LINESTRING (-99.35604 48.48666, -99.35836 48.4...\n", + "279328 279328 LINESTRING (-99.36769 48.48667, -99.37080 48.4...\n", + "279329 279329 LINESTRING (-99.36687 48.48667, -99.36769 48.4...\n", + "279330 279330 LINESTRING (-99.35836 48.48665, -99.36255 48.4...\n", + "279331 279331 LINESTRING (-99.36255 48.48666, -99.36687 48.4...\n", + "\n", + "[279332 rows x 2 columns]\n", + "./North Dakota/output\n", + "North Dakota/output\n", + " id geometry\n", + "0 0 LINESTRING (-100.78765 46.80712, -100.78765 46...\n", + "1 1 LINESTRING (-100.75321 46.81983, -100.75321 46...\n", + "2 2 LINESTRING (-100.44593 48.82124, -100.44593 48...\n", + "3 3 LINESTRING (-97.20862 46.89672, -97.20862 46.8...\n", + "4 4 LINESTRING (-96.79415 46.86518, -96.79415 46.8...\n", + "... ... ...\n", + "279327 279327 LINESTRING (-99.35604 48.48666, -99.35836 48.4...\n", + "279328 279328 LINESTRING (-99.36769 48.48667, -99.37080 48.4...\n", + "279329 279329 LINESTRING (-99.36687 48.48667, -99.36769 48.4...\n", + "279330 279330 LINESTRING (-99.35836 48.48665, -99.36255 48.4...\n", + "279331 279331 LINESTRING (-99.36255 48.48666, -99.36687 48.4...\n", + "\n", + "[279332 rows x 2 columns]\n", + "./North Dakota/output\n", + "Nevada/output\n", + " id geometry\n", + "0 0 LINESTRING (-115.32951 36.29106, -115.32951 36...\n", + "1 1 LINESTRING (-114.09841 36.79197, -114.09841 36...\n", + "2 2 LINESTRING (-115.01772 36.06770, -115.01772 36...\n", + "3 3 LINESTRING (-114.11311 36.83288, -114.11311 36...\n", + "4 4 LINESTRING (-115.28298 36.14717, -115.28298 36...\n", + "... ... ...\n", + "1493682 1493682 LINESTRING (-114.75769 41.45914, -114.75976 41...\n", + "1493683 1493683 LINESTRING (-114.75976 41.47040, -114.75982 41...\n", + "1493684 1493684 LINESTRING (-114.76031 41.47342, -114.76056 41...\n", + "1493685 1493685 LINESTRING (-114.76012 41.47241, -114.76031 41...\n", + "1493686 1493686 LINESTRING (-114.75982 41.47073, -114.76012 41...\n", + "\n", + "[1493687 rows x 2 columns]\n", + "./Nevada/output\n", + "OSError: [Errno 28] No space left on device\n", + "\n", + "During handling of the above exception, another exception occurred:\n", + "\n", + "Traceback (most recent call last):\n", + " File \"scripts/convert.py\", line 21, in \n", + " main()\n", + " File \"scripts/convert.py\", line 18, in main\n", + " data.to_csv(os.path.join(output, \"network.csv\"))\n", + " File \"/home/sina/miniconda3/lib/python3.8/site-packages/pandas/core/generic.py\", line 3167, in to_csv\n", + " formatter.save()\n", + " File \"/home/sina/miniconda3/lib/python3.8/site-packages/pandas/io/formats/csvs.py\", line 227, in save\n", + " f.close()\n", + "OSError: [Errno 28] No space left on device\n", + "Nevada/output\n", + " id geometry\n", + "0 0 LINESTRING (-115.32951 36.29106, -115.32951 36...\n", + "1 1 LINESTRING (-114.09841 36.79197, -114.09841 36...\n", + "2 2 LINESTRING (-115.01772 36.06770, -115.01772 36...\n", + "3 3 LINESTRING (-114.11311 36.83288, -114.11311 36...\n", + "4 4 LINESTRING (-115.28298 36.14717, -115.28298 36...\n", + "... ... ...\n", + "1493682 1493682 LINESTRING (-114.75769 41.45914, -114.75976 41...\n", + "1493683 1493683 LINESTRING (-114.75976 41.47040, -114.75982 41...\n", + "1493684 1493684 LINESTRING (-114.76031 41.47342, -114.76056 41...\n", + "1493685 1493685 LINESTRING (-114.76012 41.47241, -114.76031 41...\n", + "1493686 1493686 LINESTRING (-114.75982 41.47073, -114.76012 41...\n", + "\n", + "[1493687 rows x 2 columns]\n", + "./Nevada/output\n" + ] + } + ], + "source": [ + "for s in all_solutions:\n", + " o = os.path.dirname(s)\n", + " print(o)\n", + " !python scripts/convert.py './{s}' './{o}'" + ] + }, + { + "cell_type": "code", + "execution_count": 48, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "connections.csv network.csv test_lines.cpg updated.dbf\r\n", + "convert_ids.pickle solution.cpg test_lines.dbf updated.prj\r\n", + "demand_nodes.pickle solution.dbf test_lines.prj updated.shp\r\n", + "edges.pickle\t solution.prj test_lines.shp updated.shx\r\n", + "edge_to_geom.pickle solution.shp test_lines.shx\r\n", + "look_up.pickle\t solution.shx updated.cpg\r\n" + ] + } + ], + "source": [ + "!ls \"North Dakota/output\"" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Alabama\t\t\t Idaho\t New Hampshire scripts\r\n", + "Alaska\t\t\t Illinois\t New Hampshire_0 setup.py\r\n", + "Arizona\t\t\t Indiana\t New Mexico\t South Carolina\r\n", + "Arkansas\t\t Iowa\t New Mexico_0\t South Carolina_0\r\n", + "Colorado\t\t Kansas\t North Dakota\t South Dakota\r\n", + "Connecticut\t\t Kentucky\t North Dakota_0 South Dakota_0\r\n", + "convert_all_solutions.ipynb LICENSE\t Oklahoma\t tabby_cat\r\n", + "Delaware\t\t Louisiana\t Oregon\t Utah\r\n", + "District of Columbia\t Maine\t Oregon_0\t Vermont\r\n", + "District of Columbia_0\t Minnesota\t Oregon_0.zip\t Washington\r\n", + "fhk.egg-info\t\t Mississippi README.md\t West Virginia\r\n", + "Florida\t\t\t Montana\t requirements.txt West Virginia_0\r\n", + "Georgia\t\t\t Nebraska\t Rhode Island\t Wyoming\r\n", + "Hawaii\t\t\t Nevada\t Rhode Island_0\r\n" + ] + } + ], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.3" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/tabby_cat/data_loader.py b/tabby_cat/data_loader.py index c1ccffd..5e34600 100644 --- a/tabby_cat/data_loader.py +++ b/tabby_cat/data_loader.py @@ -172,7 +172,7 @@ def download_data_microsoft_buildings(self, region): zip_ref.extractall(f"{region}") for e in extracted: if e[-4:] == 'json': - self.add_files.append(f"{region}/{region}.geojson") + self.add_files.append(f"{region}/{region.replace(' ', '')}.geojson") return region @@ -192,6 +192,10 @@ def read_street_data(self, region): streets = streets_1.append(streets_2) else: streets = self.read_shp(f"./{region}_0/{self.street_file_name}") + + fb_streets = self.read_geojson(f"./{region}_0/fb_streets.geojson") + fb_streets['fclass'] = 'residential' + streets = streets.append(fb_streets) self.streets_df = streets[streets['fclass'].isin([ "residential", "primary", @@ -218,6 +222,11 @@ def read_address_data(self, region): gdf = gdf.to_crs("epsg:4326") elif file_name[-4:] == 'json': gdf = gpd.read_file(file_name) + #gdf = gdf.to_crs('epsg:3857') + #bounding_box = gdf.envelope + #buff_box = bounding_box.buffer(6) + #u_box = pd.DataFrame({"geom": [p.centroid for p in buff_box.unary_union]}) + #points_df = gpd.GeoDataFrame(u_box, geometry='geom', crs='epsg:3857') gdf.geometry = gdf.geometry.apply(lambda x: Point(x.centroid.coords[0])) if self.address_df is None: self.address_df = gdf diff --git a/tabby_cat/main.py b/tabby_cat/main.py index 8fe96b6..5c9b637 100644 --- a/tabby_cat/main.py +++ b/tabby_cat/main.py @@ -11,38 +11,39 @@ def main(): logging.basicConfig(filename='log.log',level=logging.DEBUG) - + where = sys.argv[1] logging.info("Started DataLoader") dl = DataLoader() - for where in dl.known_regions: - logging.info(f"Running on {where}") - - logging.info("Getting data from geofabrik") - dl.download_data_geofabrik(where) - logging.info("Reading street data") - dl.read_street_data(where) - logging.info("Getting data from microsoft buildings") - dl.download_data_microsoft_buildings(where) - logging.info("Reading address data") - dl.read_address_data(where) - - logging.info("Starting processing") - pr = Processor(where) - logging.info("Snapping addresses to streets") - pr.snap_points_to_line(dl.streets_df, dl.address_df) - logging.info("Converting GIS to graph") - pr.geom_to_graph() - logging.info("Writing intermediate files") - pr.store_intermediate() - - logging.info("Create solver") - sl = PCSTSolver(pr.edges, pr.look_up, pr.demand_nodes) - logging.info("Running solve") - sl.solve() - - pr.graph_to_geom(sl.s_edges) - - pr.solution.to_crs("epsg:4326").to_file(f"{where}/output/solution.shp") + logging.info(f"Running on {where}") + + logging.info("Getting data from geofabrik") + dl.download_data_geofabrik(where) + logging.info("Reading street data") + dl.read_street_data(where) + logging.info("Getting data from microsoft buildings") + dl.download_data_microsoft_buildings(where) + logging.info("Reading address data") + dl.read_address_data(where) + + logging.info("Starting processing") + pr = Processor(where) + logging.info("Snapping addresses to streets") + pr.snap_points_to_line(dl.streets_df, dl.address_df) + logging.info("Connected nearby demand") + pr.connect_demand_with_range(dl.address_df) + logging.info("Converting GIS to graph") + pr.geom_to_graph() + logging.info("Writing intermediate files") + pr.store_intermediate() + + logging.info("Create solver") + sl = PCSTSolver(pr.edges, pr.look_up, pr.demand_nodes) + logging.info("Running solve") + sl.solve() + + pr.graph_to_geom(sl.s_edges) + + pr.solution.to_crs("epsg:4326").to_file(f"{where}/output/solution.shp") if __name__ == "__main__": logging.basicConfig(level=logging.INFO) diff --git a/tabby_cat/processor.py b/tabby_cat/processor.py index 00950ae..037668b 100644 --- a/tabby_cat/processor.py +++ b/tabby_cat/processor.py @@ -32,7 +32,7 @@ def __init__(self, where): self.edges = OrderedDict() self.index = 0 - def _parallelize(self, points, lines): + def _parallelize(self, points, lines, demand_points=False): """ Concept taken from here: https://swanlund.space/parallelizing-python """ @@ -42,7 +42,7 @@ def _parallelize(self, points, lines): pool = mp.Pool(processes=cpus) - chunk_processes = [pool.apply_async(self._snap_part, args=(chunk, lines)) for chunk in intersection_chunks] + chunk_processes = [pool.apply_async(self._snap_part, args=(chunk, lines, demand_points)) for chunk in intersection_chunks] intersection_results = [chunk.get() for chunk in chunk_processes] @@ -50,7 +50,7 @@ def _parallelize(self, points, lines): return intersections_dist - def _snap_part(self, gdf_chunk, lines): + def _snap_part(self, gdf_chunk, lines, demand_points=False): offset = 1000 bbox = gdf_chunk.bounds + [-offset, -offset, offset, offset] @@ -78,6 +78,9 @@ def _snap_part(self, gdf_chunk, lines): tmp = tmp.sort_values(by=["snap_dist"]) # group by the index of the points and take the first, which is the # closest line + if demand_points: + return tmp[tmp.snap_dist <= 50] + closest = tmp.groupby("pt_idx").first() # construct a GeoDataFrame of the closest lines @@ -85,7 +88,7 @@ def _snap_part(self, gdf_chunk, lines): def points_to_multipoint(self, data): coords = set() - for p in data.snapped: + for p in data.point: coords.add(p.coords[0]) self.demand.add(p.coords[0]) @@ -115,6 +118,7 @@ def snap_points_to_line(self, lines, points, write=True): self.lines = lines closest = self._parallelize(points, lines) + self.closest_streets = closest # Position of nearest point from start of the line series = gpd.GeoSeries(closest.point) series.crs = {'init': 'epsg:3857'} @@ -131,25 +135,25 @@ def snap_points_to_line(self, lines, points, write=True): split_lines_df = pd.DataFrame({"geom": split_lines}, index=[i for i in range(len(split_lines))]) self.cut_lines = gpd.GeoDataFrame(split_lines_df, geometry="geom", crs="epsg:3857") - # Join back to the original points: - updated_points = points.drop(columns=["geometry"]).join(snapped) - # You may want to drop any that didn't snap, if so: + points.dropna(subset=["geometry"]).geometry.apply(lambda x: self.get_demand_nodes(x)) + updated_points = points.drop(columns="geometry").join(snapped) updated_points.dropna(subset=["geometry"]).geometry.apply(lambda x: self.get_demand_nodes(x)) + self.snap_lines = closest.apply(lambda x: LineString([x.point.coords[0], x.snapped.coords[0]]), axis=1) + snap_df = pd.DataFrame({"geom": self.snap_lines}, index=[i for i in range(len(self.snap_lines))]) + self.snap_gdf = gpd.GeoDataFrame(snap_df, geometry="geom", crs="epsg:3857") + self.snap_gdf = self.snap_gdf.dropna() + self.snap_gdf['length'] = self.snap_gdf.apply(lambda x: x.geom.length, axis=1) + if write: if not os.path.isdir(f"{self.where}/output"): os.mkdir(f"{self.where}/output") updated_points.to_file(f"{self.where}/output/updated.shp") - snap_lines = closest.apply(lambda x: LineString([x.point.coords[0], x.snapped.coords[0]]), axis=1) - snap_df = pd.DataFrame({"geom": snap_lines}, index=[i for i in range(len(snap_lines))]) - snap_gdf = gpd.GeoDataFrame(snap_df, geometry="geom", crs="epsg:3857") - snap_gdf = snap_gdf.dropna() - snap_gdf['length'] = snap_gdf.apply(lambda x: x.geom.length, axis=1) - snap_gdf = snap_gdf.to_crs('epsg:4326') - snap_gdf['lat'] = snap_gdf.geometry.apply(lambda x: x.coords[0][0]) - snap_gdf['lon'] = snap_gdf.geometry.apply(lambda x: x.coords[0][1]) - snap_gdf[["lat", "lon", "length"]].to_csv(f"{self.where}/output/connections.csv") - snap_gdf.to_file(f"{self.where}/output/test_lines.shp") + self.snap_gdf = self.snap_gdf.to_crs('epsg:4326') + self.snap_gdf['lat'] = self.snap_gdf.geometry.apply(lambda x: x.coords[0][0]) + self.snap_gdf['lon'] = self.snap_gdf.geometry.apply(lambda x: x.coords[0][1]) + self.snap_gdf[["lat", "lon", "length"]].to_csv(f"{self.where}/output/connections.csv") + self.snap_gdf.to_file(f"{self.where}/output/test_lines.shp") def get_demand_nodes(self, geometry): coords = geometry.coords[0] @@ -213,6 +217,13 @@ def expand_lines(self, geom): else: return LineString(new_lines[0]) + def connect_demand_with_range(self, points): + points = points.to_crs('epsg:3857') + results = self._parallelize(points, points, demand_points=True) + results = results[results.pt_idx.isin(self.closest_streets[self.closest_streets.snap_dist > 50].index)] + results = results[results.snap_dist > 0] + self.connected_demand = results.apply(lambda x: LineString([x.geometry.coords[0], x.point.coords[0]]), axis=1) + def geom_to_graph(self): if not self.edges: self.cut_lines = self.cut_lines.dropna() @@ -220,6 +231,8 @@ def geom_to_graph(self): self.lines.geometry = self.lines.geometry.apply(lambda x: self.expand_lines(x)) self.cut_lines.geometry.apply(lambda x: self.set_node_ids(x)) self.lines.geometry.apply(lambda x: self.set_node_ids(x)) + self.snap_gdf.geometry.apply(lambda x: self.set_node_ids(x)) + self.connected_demand.apply(lambda x: self.set_node_ids(x)) g = nx.Graph() g.add_edges_from(self.edges)