pip install geopandas pip install fiona pip install pygeoif python import geopandas as gpd data = gpd.read_file('your_geojson_file.geojson') print(data.head()) print(data.dtypes) print(data.crs) selected_data = data[data['something'] == 'your_condition'] selected_data.to_file('selected_data.geojson', driver='GeoJSON') python import fiona with fiona.open('your_geojson_file.geojson', 'r') as src: for feature in src: geometry = feature['geometry'] properties = feature['properties'] # ... schema = { 'geometry': 'Point', 'properties': { 'name': 'str', 'age': 'int', } } with fiona.open('new_geojson_file.geojson', 'w', 'GeoJSON', schema) as dst: dst.write({ 'geometry': { 'type': 'Point', 'coordinates': [x, y] }, 'properties': { 'name': 'John', 'age': 25 } }) python from pygeoif import geometry point = geometry.Point(x, y) line = geometry.LineString([(x1, y1), (x2, y2), (x3, y3)]) polygon = geometry.Polygon([(x1, y1), (x2, y2), (x3, y3)]) print(point.coords) print(line.intersects(polygon)) buffered_polygon = polygon.buffer(0.1)


上一篇:
下一篇:
切换中文