ccfx 0.6.0__py3-none-any.whl → 0.8.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ccfx/ccfx.py +44 -1
- {ccfx-0.6.0.dist-info → ccfx-0.8.0.dist-info}/METADATA +1 -1
- {ccfx-0.6.0.dist-info → ccfx-0.8.0.dist-info}/RECORD +6 -6
- {ccfx-0.6.0.dist-info → ccfx-0.8.0.dist-info}/WHEEL +0 -0
- {ccfx-0.6.0.dist-info → ccfx-0.8.0.dist-info}/licenses/LICENSE +0 -0
- {ccfx-0.6.0.dist-info → ccfx-0.8.0.dist-info}/top_level.txt +0 -0
ccfx/ccfx.py
CHANGED
@@ -258,7 +258,7 @@ def downloadChunk(url, start, end, path):
|
|
258
258
|
if chunk:
|
259
259
|
f.write(chunk)
|
260
260
|
|
261
|
-
def downloadFile(url, save_path, exists_action='resume', num_connections=
|
261
|
+
def downloadFile(url, save_path, exists_action='resume', num_connections=5, v=True):
|
262
262
|
if v:
|
263
263
|
print(f"\ndownloading {url}")
|
264
264
|
fname = getFileBaseName(url, extension=True)
|
@@ -490,6 +490,26 @@ def readFrom(filename, decode_codec = None, v=False):
|
|
490
490
|
g.close
|
491
491
|
return file_text
|
492
492
|
|
493
|
+
|
494
|
+
def pointsToGeodataframe(point_pairs_list, columns = ['latitude', 'longitude'], auth = "EPSG", code = '4326', out_shape = '', format = 'gpkg', v = False, get_geometry_only = False):
|
495
|
+
df = pandas.DataFrame(point_pairs_list, columns = columns)
|
496
|
+
geometry = [Point(xy) for xy in zip(df['latitude'], df['longitude'])]
|
497
|
+
|
498
|
+
if get_geometry_only:
|
499
|
+
return geometry[0]
|
500
|
+
|
501
|
+
gdf = geopandas.GeoDataFrame(point_pairs_list, columns = columns, geometry=geometry)
|
502
|
+
drivers = {'gpkg': 'GPKG', 'shp': 'ESRI Shapefile'}
|
503
|
+
|
504
|
+
gdf = gdf.set_crs(f'{auth}:{code}')
|
505
|
+
|
506
|
+
if out_shape != '':
|
507
|
+
if v: print(f'creating shapefile {out_shape}')
|
508
|
+
gdf.to_file(out_shape, driver=drivers[format])
|
509
|
+
|
510
|
+
return gdf
|
511
|
+
|
512
|
+
|
493
513
|
def readFile(filename, decode_codec = None, v=False):
|
494
514
|
return readFrom(filename, decode_codec, v)
|
495
515
|
|
@@ -1193,6 +1213,29 @@ def listAllFiles(folder, extension="*"):
|
|
1193
1213
|
return list_of_files
|
1194
1214
|
|
1195
1215
|
|
1216
|
+
def clipFeatures(inputFeaturePath:str, boundaryFeature:str, outputFeature:str, keepOnlyTypes = None, v = False) -> geopandas.GeoDataFrame:
|
1217
|
+
'''
|
1218
|
+
keepOnlyTypes = ['MultiPolygon', 'Polygon', 'Point', etc]
|
1219
|
+
|
1220
|
+
'''
|
1221
|
+
mask_gdf = geopandas.read_file(boundaryFeature)
|
1222
|
+
input_gdf = geopandas.read_file(inputFeaturePath)
|
1223
|
+
|
1224
|
+
outDir = os.path.dirname(outputFeature)
|
1225
|
+
createPath(f"{outDir}/")
|
1226
|
+
out_gdf = input_gdf.clip(mask_gdf.to_crs(input_gdf.crs))
|
1227
|
+
|
1228
|
+
if not keepOnlyTypes is None:
|
1229
|
+
out_gdf = out_gdf[out_gdf.geometry.apply(lambda x : x.type in keepOnlyTypes)]
|
1230
|
+
|
1231
|
+
out_gdf.to_file(outputFeature)
|
1232
|
+
|
1233
|
+
if v:
|
1234
|
+
print("\t - clipped feature to " + outputFeature)
|
1235
|
+
return out_gdf
|
1236
|
+
|
1237
|
+
|
1238
|
+
|
1196
1239
|
def createPointGeometry(coords: list, proj: str = "EPSG:4326") -> geopandas.GeoDataFrame:
|
1197
1240
|
'''
|
1198
1241
|
Convert list of coordinate tuples to GeoDataFrame
|
@@ -1,11 +1,11 @@
|
|
1
1
|
ccfx/__init__.py,sha256=VmBeF3oj6JTJ_793d4i8PvhyF8_FxaxA1L_FmHWqitc,142
|
2
|
-
ccfx/ccfx.py,sha256=
|
2
|
+
ccfx/ccfx.py,sha256=L0BeQLs4H9o8MlKlmr7pHqFmjbd5A3yDBKsk3XSzU5s,56313
|
3
3
|
ccfx/excel.py,sha256=cQ4TQW49XqbMB3sSS0IOhO3-WArIolEBIrvOvhFyPtI,4757
|
4
4
|
ccfx/mssqlConnection.py,sha256=TwyZXhHHI7zy6BSfH1pszuHVJ5cmndRC5dVxvEtSTks,7904
|
5
5
|
ccfx/sqliteConnection.py,sha256=jEJ94D5ySt84N7AeDpa27Rclt1NaKhkX6nYzidwApIg,11104
|
6
6
|
ccfx/word.py,sha256=AGa64jX5Zl5qotZh5L0QmrsjTnktIBhmj_ByRKZ88vw,3061
|
7
|
-
ccfx-0.
|
8
|
-
ccfx-0.
|
9
|
-
ccfx-0.
|
10
|
-
ccfx-0.
|
11
|
-
ccfx-0.
|
7
|
+
ccfx-0.8.0.dist-info/licenses/LICENSE,sha256=2-M3fBUS3FmrSIrqd3cZDmxXxojWVJtZY-SHSRE6RxM,1098
|
8
|
+
ccfx-0.8.0.dist-info/METADATA,sha256=1BskaEpbKDSaouiPDW9xdIlLdb62qPwwFjH2mUi9mpQ,5425
|
9
|
+
ccfx-0.8.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
10
|
+
ccfx-0.8.0.dist-info/top_level.txt,sha256=_cSvSA1WX2K8TgoV3iBJUdUZZqMKJbOPLNnKLYSLHaw,5
|
11
|
+
ccfx-0.8.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|