Hướng dẫn spatial data analysis using python - phân tích dữ liệu không gian bằng python

Chú ý

Sinh viên Đại học Phần Lan được khuyến khích sử dụng nền tảng Notebooks CSC.

Những người khác có thể theo dõi bài học tương tác bằng cách sử dụng chất kết dính. Kiểm tra biểu tượng tên lửa trên đầu trang này.

Trong tuần đầu tiên, chúng tôi sẽ tham quan nhanh đến hệ sinh thái khoa học dữ liệu Python, [không gian] và xem cách chúng tôi có thể sử dụng một số gói Python nguồn mở cơ bản, chẳng hạn như:

  • Gandas / Geopandas

  • hình dạng

  • Pysal

  • pyproj

  • osmnx / pyrosm

  • matplotlib [trực quan]

Như bạn có thể thấy, chúng tôi đã giành chiến thắng sử dụng bất kỳ phần mềm GIS nào để thực hiện lập trình [như ArcGIS/Arcpy hoặc QGIS], nhưng tập trung vào việc học các gói nguồn mở độc lập với bất kỳ phần mềm cụ thể nào. Các thư viện này hình thành hiện nay không chỉ là cốt lõi cho khoa học dữ liệu không gian hiện đại, mà chúng còn là những phần cơ bản của các ứng dụng thương mại được sử dụng và phát triển bởi nhiều công ty trên thế giới.

Ghi chú

Nếu bạn có kinh nghiệm làm việc với ngăn xếp khoa học dữ liệu không gian Python, thì hướng dẫn này có lẽ không mang lại nhiều mới cho bạn, nhưng để đưa mọi người lên cùng một trang, tất cả chúng ta sẽ trải qua hướng dẫn giới thiệu này.

Contents:

  • Đọc / Viết dữ liệu không gian

  • Lấy dữ liệu OpenStreetMap

  • Tái sử dụng

  • Tham gia không gian

  • Vẽ dữ liệu với matplotlib

Thư viện cơ bản: Geopandas¶

Trong khóa học này, gói Python thường được sử dụng nhất mà bạn sẽ học là Geopandas. Geopandas giúp nó có thể làm việc với dữ liệu không gian địa lý trong Python một cách tương đối dễ dàng. GeoPandas kết hợp các khả năng của gấu trúc thư viện phân tích dữ liệu với các gói khác như SHAPLY và FIONA để quản lý dữ liệu không gian. Các cấu trúc dữ liệu chính trong GeoPandas là

# Output filepath
outfp = "data/buildings_copy.shp"
data.to_file[outfp]
7 và
# Output filepath
outfp = "data/buildings_copy.shp"
data.to_file[outfp]
8 mở rộng khả năng của
# Output filepath
outfp = "data/buildings_copy.shp"
data.to_file[outfp]
9 và
from pyrosm import OSM, get_data

# Download data for Helsinki
fp = get_data["helsinki"]

# Initialize the reader object for Helsinki
osm = OSM[fp]
0 từ gấu trúc. Trong trường hợp bạn muốn có thêm trợ giúp để bắt đầu với Pandas, chúng tôi khuyên bạn nên xem bài học 5 và 6 từ địa lý địa lý có sẵn công khai. Sự khác biệt chính giữa các khung hình gayfataFrame và gấu trúc là một khung geodataframe nên chứa [ít nhất] một cột cho hình học. Theo mặc định, tên của cột này là
from pyrosm import OSM, get_data

# Download data for Helsinki
fp = get_data["helsinki"]

# Initialize the reader object for Helsinki
osm = OSM[fp]
1. Cột hình học là một địa chất chứa các hình học [điểm, đường, đa giác, đa đường, v.v.] như các đối tượng định hình.Geo-Python -course. The main difference between GeoDataFrames and pandas DataFrames is that a GeoDataFrame should contain [at least] one column for geometries. By default, the name of this column is
from pyrosm import OSM, get_data

# Download data for Helsinki
fp = get_data["helsinki"]

# Initialize the reader object for Helsinki
osm = OSM[fp]
1. The geometry column is a GeoSeries which contains the geometries [points, lines, polygons, multipolygons etc.] as shapely objects.

Đọc và viết dữ liệu không gian

Tiếp theo chúng ta sẽ tìm hiểu một số chức năng cơ bản của Geopandas. Chúng tôi có một vài tệp Geojson được lưu trữ trong thư mục

from pyrosm import OSM, get_data

# Download data for Helsinki
fp = get_data["helsinki"]

# Initialize the reader object for Helsinki
osm = OSM[fp]
2 mà chúng tôi sẽ sử dụng.

Chúng ta có thể đọc dữ liệu một cách dễ dàng với

from pyrosm import OSM, get_data

# Download data for Helsinki
fp = get_data["helsinki"]

# Initialize the reader object for Helsinki
osm = OSM[fp]
3 -function:

import geopandas as gpd

# Filepath
fp = "data/buildings.geojson"

# Read the file
data = gpd.read_file[fp]

# How does it look?
data.head[]

addr:cityaddr:countryaddr:housenumberaddr:housenameaddr:postcodeaddr:streete-mailTênopening_hoursnhà điều hành...start_dateWikipediaTôiDấu thời gianphiên bảnTagsosm_typeinternet_accessThay đổihình học01234
HelsinkiKhông có29 Không có00170 UnioninkatuKhông cóKhông cóKhông cóKhông cóUnioninkatuKhông cóKhông có4253124 1542041335 4 Không cóUnioninkatuKhông cóUnioninkatu...
HelsinkiKhông có2 Không có00100 Unioninkatu ...đườngKhông cóUnioninkatu1887 ...8033120 1544822447 27 đườngUnioninkatuKhông cóUnioninkatu...
HelsinkiKhông cóUnioninkatuKhông cóKhông cóUnioninkatuKhông cóUnioninkatuKhông cóKhông cóUnioninkatu1936 ...8035238 1533831167 23 đườngUnioninkatuKhông cóUnioninkatu...
HelsinkiKhông có2 Không có00100 UnioninkatuKhông cóUnioninkatu...Không cóUnioninkatu1998 ...8042215 1553963033 30 đườngUnioninkatuKhông cóUnioninkatu...
Không cóKhông cóKhông cóKhông cóKhông cóKhông cóKhông cóKhông cóKhông cóKhông cóUnioninkatuKhông cóKhông có15243643 1546289715 7 Không cóUnioninkatuKhông cóUnioninkatu...

đường

Nan


RangeIndex: 486 entries, 0 to 485
Data columns [total 34 columns]:
 #   Column              Non-Null Count  Dtype   
---  ------              --------------  -----   
 0   addr:city           86 non-null     object  
 1   addr:country        57 non-null     object  
 2   addr:housenumber    88 non-null     object  
 3   addr:housename      4 non-null      object  
 4   addr:postcode       54 non-null     object  
 5   addr:street         89 non-null     object  
 6   email               2 non-null      object  
 7   name                81 non-null     object  
 8   opening_hours       8 non-null      object  
 9   operator            7 non-null      object  
 10  phone               8 non-null      object  
 11  ref                 1 non-null      object  
 12  url                 8 non-null      object  
 13  website             20 non-null     object  
 14  building            486 non-null    object  
 15  amenity             26 non-null     object  
 16  building:levels     162 non-null    object  
 17  building:material   2 non-null      object  
 18  building:min_level  4 non-null      object  
 19  height              17 non-null     object  
 20  landuse             2 non-null      object  
 21  office              5 non-null      object  
 22  shop                5 non-null      object  
 23  source              3 non-null      object  
 24  start_date          87 non-null     object  
 25  wikipedia           47 non-null     object  
 26  id                  486 non-null    int64   
 27  timestamp           486 non-null    int64   
 28  version             486 non-null    int64   
 29  tags                181 non-null    object  
 30  osm_type            486 non-null    object  
 31  internet_access     1 non-null      object  
 32  changeset           66 non-null     float64 
 33  geometry            486 non-null    geometry
dtypes: float64[1], geometry[1], int64[3], object[29]
memory usage: 129.2+ KB

Polygon [[24.95121 60.16999, 24.95122 60.16988 ...

TôiDấu thời gianphiên bảnThay đổihình họcHelsinkiKhông cóUnioninkatu25%50%75%...
4.860000e+02 4.860000e+02 486.000000 66.0
1.400780e+08 1.455829e+09 4.849794 0.0
1.633527e+08 9.247528e+07 4.561162 0.0
8.253000e+03 1.197929e+09 1.000000 0.0
2.294267e+07 1.374229e+09 2.000000 0.0
1.228699e+08 1.493288e+09 3.000000 0.0
1.359805e+08 1.530222e+09 7.000000 0.0
1.042029e+09 1.555840e+09 31.000000 0.0

đường

Đương nhiên, vì dữ liệu là không gian, chúng tôi muốn hình dung nó để hiểu bản chất của dữ liệu tốt hơn. Chúng ta có thể làm điều này một cách dễ dàng với phương pháp

from pyrosm import OSM, get_data

# Download data for Helsinki
fp = get_data["helsinki"]

# Initialize the reader object for Helsinki
osm = OSM[fp]
5:spatial, we want to visualize it to understand the nature of the data better. We can do this easily with
from pyrosm import OSM, get_data

# Download data for Helsinki
fp = get_data["helsinki"]

# Initialize the reader object for Helsinki
osm = OSM[fp]
5 method:

Bây giờ chúng ta có thể thấy rằng dữ liệu thực sự đại diện cho các tòa nhà [ở trung tâm Helsinki]. Đương nhiên chúng ta cũng có thể viết dữ liệu này vào đĩa. GeoPandas hỗ trợ ghi dữ liệu vào các định dạng dữ liệu khác nhau cũng như Postgis, đây là cơ sở dữ liệu nguồn mở được sử dụng rộng rãi nhất cho GIS. Hãy cùng viết dữ liệu như một spapefile cho cùng một thư mục

from pyrosm import OSM, get_data

# Download data for Helsinki
fp = get_data["helsinki"]

# Initialize the reader object for Helsinki
osm = OSM[fp]
2 từ nơi chúng tôi đọc dữ liệu. Khi ghi dữ liệu vào đĩa cục bộ, bạn có thể sử dụng phương thức
from pyrosm import OSM, get_data

# Download data for Helsinki
fp = get_data["helsinki"]

# Initialize the reader object for Helsinki
osm = OSM[fp]
7 để xuất dữ liệu ở định dạng Shapefile theo mặc định:

# Output filepath
outfp = "data/buildings_copy.shp"
data.to_file[outfp]

Lấy dữ liệu từ OpenStreetMap¶

Bây giờ chúng ta đã thấy cách đọc dữ liệu không gian từ đĩa. OpenStreetMap [OSM] có lẽ là bộ dữ liệu/cơ sở dữ liệu không gian được sử dụng rộng rãi nhất và được sử dụng rộng rãi trên thế giới. Cũng trong khóa học này, chúng tôi sẽ sử dụng dữ liệu OSM thường xuyên. Do đó, hãy để Lừa xem cách chúng ta có thể truy xuất dữ liệu từ OSM bằng thư viện có tên là PYROSM. Với

from pyrosm import OSM, get_data

# Download data for Helsinki
fp = get_data["helsinki"]

# Initialize the reader object for Helsinki
osm = OSM[fp]
8, bạn có thể dễ dàng tải xuống và trích xuất dữ liệu từ mọi nơi trên thế giới dựa trên các tệp OSM.PBF được phân phối, ví dụ: bởi Geofabrik. Công cụ này nhằm mục đích trở thành một cách hiệu quả để phân tích dữ liệu OSM bao gồm các khu vực địa lý lớn [như quốc gia và thành phố], nhưng như một nhược điểm, nó có một chút hạn chế theo nghĩa nào bạn có thể xác định khu vực quan tâm của mình. Với
from pyrosm import OSM, get_data

# Download data for Helsinki
fp = get_data["helsinki"]

# Initialize the reader object for Helsinki
osm = OSM[fp]
8, bạn có thể trích xuất dữ liệu OSM từ 654 khu vực trên thế giới [bao gồm tất cả các quốc gia cộng với nhiều khu vực thành phố, xem tài liệu để biết thêm thông tin].

Ghi chú

Trong trường hợp bạn muốn trích xuất dữ liệu OSM từ các khu vực nhỏ hơn, ví dụ: Sử dụng bộ đệm 2 km xung quanh một vị trí cụ thể, chúng tôi khuyên bạn nên sử dụng thư viện OSMNX, linh hoạt hơn về mặt chỉ định khu vực quan tâm.

Hãy để xem cách chúng ta có thể tải xuống và trích xuất dữ liệu OSM cho Vùng Helsinki bằng cách sử dụng

from pyrosm import OSM, get_data

# Download data for Helsinki
fp = get_data["helsinki"]

# Initialize the reader object for Helsinki
osm = OSM[fp]
8:

from pyrosm import OSM, get_data

# Download data for Helsinki
fp = get_data["helsinki"]

# Initialize the reader object for Helsinki
osm = OSM[fp]

Downloaded Protobuf data 'Helsinki.osm.pbf' [28.79 MB] to:
'/tmp/pyrosm/Helsinki.osm.pbf'

Bước đầu tiên, chúng tôi đã tải xuống dữ liệu cho Helsinki, sử dụng hàm

Downloaded Protobuf data 'Helsinki.osm.pbf' [28.79 MB] to:
'/tmp/pyrosm/Helsinki.osm.pbf'
1, đây là hàm trợ giúp tự động hóa quy trình tải xuống dữ liệu và lưu dữ liệu cục bộ trong thư mục tạm thời [bên trong
Downloaded Protobuf data 'Helsinki.osm.pbf' [28.79 MB] to:
'/tmp/pyrosm/Helsinki.osm.pbf'
2 trong trường hợp này]. Bước tiếp theo mà chúng tôi đã làm, là khởi tạo một đối tượng đầu đọc có tên là
Downloaded Protobuf data 'Helsinki.osm.pbf' [28.79 MB] to:
'/tmp/pyrosm/Helsinki.osm.pbf'
3.
Downloaded Protobuf data 'Helsinki.osm.pbf' [28.79 MB] to:
'/tmp/pyrosm/Helsinki.osm.pbf'
3 đưa FilePath đến một tệp
Downloaded Protobuf data 'Helsinki.osm.pbf' [28.79 MB] to:
'/tmp/pyrosm/Helsinki.osm.pbf'
5 đã cho làm đầu vào. Lưu ý rằng tại thời điểm này, chúng tôi đã không đọc bất kỳ dữ liệu nào về Geodataframe.

OSM là một cơ sở dữ liệu của thế giới, do đó, nó chứa rất nhiều thông tin về những thứ khác nhau. Với

from pyrosm import OSM, get_data

# Download data for Helsinki
fp = get_data["helsinki"]

# Initialize the reader object for Helsinki
osm = OSM[fp]
8, bạn có thể dễ dàng trích xuất thông tin về:a lot of information about different things. With
from pyrosm import OSM, get_data

# Download data for Helsinki
fp = get_data["helsinki"]

# Initialize the reader object for Helsinki
osm = OSM[fp]
8 you can easily extract information about:

  • Mạng đường phố ->

    Downloaded Protobuf data 'Helsinki.osm.pbf' [28.79 MB] to:
    '/tmp/pyrosm/Helsinki.osm.pbf'
    
    7

  • các tòa nhà ->

    Downloaded Protobuf data 'Helsinki.osm.pbf' [28.79 MB] to:
    '/tmp/pyrosm/Helsinki.osm.pbf'
    
    8

  • Điểm quan tâm [POI] ->

    Downloaded Protobuf data 'Helsinki.osm.pbf' [28.79 MB] to:
    '/tmp/pyrosm/Helsinki.osm.pbf'
    
    9

  • Landuse ->

    buildings = osm.get_buildings[]
    
    0

  • Các yếu tố tự nhiên ->

    buildings = osm.get_buildings[]
    
    1

  • ranh giới ->

    buildings = osm.get_buildings[]
    
    2

Hãy để xem cách chúng ta có thể đọc tất cả các tòa nhà từ Vùng Helsinki:

buildings = osm.get_buildings[]

addr:cityaddr:countryaddr:fulladdr:housenumberaddr:housenameaddr:postcodeaddr:placeaddr:streete-mailTên...nguồnstart_dateWikipediaTôiDấu thời gianphiên bảnhình họcTagsosm_typeThay đổi01234
EspooFiKhông có2 Không có02150 Không cóKonemiehentieKhông cóKonemiehentieAalto TietotekniikkaKhông có1998 Không có4217650 0 -1 KonemiehentieAalto Tietotekniikka...Polygon [[24.82129 60.18718, 24.82164 60.18712 ...
Không cóKhông cóKhông cóKhông cóKhông cóKhông cóKhông cóKhông cóKhông cóKhông cóAalto TietotekniikkaKhông cóKhông cóKhông có4217760 0 -1 KonemiehentieAalto Tietotekniikka...Polygon [[24.82129 60.18718, 24.82164 60.18712 ...
Không cóKhông cóKhông cóKhông cóKhông cóKhông cóKhông cóKhông cóKhông cóKhông cóAalto TietotekniikkaKhông cóKhông cóKhông có4220761 0 -1 KonemiehentieKhông có...Polygon [[24.82129 60.18718, 24.82164 60.18712 ...
{"alt_name": "t-talo", "loc_name": "tikkitalo", "n ...FiKhông có5 Konemiehentie00250 Không cóKonemiehentieKhông cóKonemiehentieAalto TietotekniikkaKhông cóKhông cóKhông có4252923 0 -1 KonemiehentieAalto Tietotekniikka...Polygon [[24.82129 60.18718, 24.82164 60.18712 ...
EspooKhông cóKhông có9 Không có02150 Không cóKonemiehentieKhông cóKonemiehentieAalto Tietotekniikka...Không cóKhông có4252948 0 -1 KonemiehentieAalto Tietotekniikka...Polygon [[24.82129 60.18718, 24.82164 60.18712 ...

{"alt_name": "t-talo", "loc_name": "tikkitalo", "n ...

đường

Nan

Polygon [[24.83776 60.18905, 24.83796 60.18938 ...

{"Truy cập": "Riêng tư", "Đỗ xe": "Multi-Storey", "...

Polygon [[24.85599 60.20719, 24.85590 60.20719 ...


Name: WGS 84
Axis Info [ellipsoidal]:
- Lat[north]: Geodetic latitude [degree]
- Lon[east]: Geodetic longitude [degree]
Area of Use:
- name: World
- bounds: [-180.0, -90.0, 180.0, 90.0]
Datum: World Geodetic System 1984
- Ellipsoid: WGS 84
- Prime Meridian: Greenwich

Do đó, chúng tôi nhận được thông tin về CRS và chúng tôi có thể thấy rằng dữ liệu thực sự nằm trong WGS84. Chúng ta cũng có thể thấy rằng mã EPSG cho CRS là 4326. Chúng ta có thể dễ dàng tái tạo dữ liệu của mình bằng cách sử dụng phương thức

buildings = osm.get_buildings[]
6. Cách dễ nhất để sử dụng phương thức là chỉ định CRS đích làm mã EPSG. Hãy để từ chối dữ liệu của chúng tôi vào EPSG 3067, đây là hệ thống tham chiếu tọa độ được sử dụng rộng rãi nhất được sử dụng ở Phần Lan, Euref-Fin:

projected = buildings.to_crs[epsg=3067]
projected.crs


Name: ETRS89 / TM35FIN[E,N]
Axis Info [cartesian]:
- E[east]: Easting [metre]
- N[north]: Northing [metre]
Area of Use:
- name: Finland
- bounds: [19.08, 58.84, 31.59, 70.09]
Coordinate Operation:
- name: TM35FIN
- method: Transverse Mercator
Datum: European Terrestrial Reference System 1989
- Ellipsoid: GRS 1980
- Prime Meridian: Greenwich

Như chúng ta có thể thấy, bây giờ chúng ta có một

buildings = osm.get_buildings[]
7 do đó. Để xác nhận sự khác biệt, hãy để Lừa xem hình dạng của hàng đầu tiên trong
buildings = osm.get_buildings[]
8 geodataframe ban đầu của chúng tôi và geodataframe
buildings = osm.get_buildings[]
9. Để chọn một hàng cụ thể trong dữ liệu, chúng tôi có thể sử dụng lập chỉ mục

Name: WGS 84
Axis Info [ellipsoidal]:
- Lat[north]: Geodetic latitude [degree]
- Lon[east]: Geodetic longitude [degree]
Area of Use:
- name: World
- bounds: [-180.0, -90.0, 180.0, 90.0]
Datum: World Geodetic System 1984
- Ellipsoid: WGS 84
- Prime Meridian: Greenwich
0:

orig_geom = buildings.loc[0, "geometry"]
projected_geom = projected.loc[0, "geometry"]

print["Orig:\n", orig_geom, "\n"]
print["Proj:\n", projected_geom]


RangeIndex: 486 entries, 0 to 485
Data columns [total 34 columns]:
 #   Column              Non-Null Count  Dtype   
---  ------              --------------  -----   
 0   addr:city           86 non-null     object  
 1   addr:country        57 non-null     object  
 2   addr:housenumber    88 non-null     object  
 3   addr:housename      4 non-null      object  
 4   addr:postcode       54 non-null     object  
 5   addr:street         89 non-null     object  
 6   email               2 non-null      object  
 7   name                81 non-null     object  
 8   opening_hours       8 non-null      object  
 9   operator            7 non-null      object  
 10  phone               8 non-null      object  
 11  ref                 1 non-null      object  
 12  url                 8 non-null      object  
 13  website             20 non-null     object  
 14  building            486 non-null    object  
 15  amenity             26 non-null     object  
 16  building:levels     162 non-null    object  
 17  building:material   2 non-null      object  
 18  building:min_level  4 non-null      object  
 19  height              17 non-null     object  
 20  landuse             2 non-null      object  
 21  office              5 non-null      object  
 22  shop                5 non-null      object  
 23  source              3 non-null      object  
 24  start_date          87 non-null     object  
 25  wikipedia           47 non-null     object  
 26  id                  486 non-null    int64   
 27  timestamp           486 non-null    int64   
 28  version             486 non-null    int64   
 29  tags                181 non-null    object  
 30  osm_type            486 non-null    object  
 31  internet_access     1 non-null      object  
 32  changeset           66 non-null     float64 
 33  geometry            486 non-null    geometry
dtypes: float64[1], geometry[1], int64[3], object[29]
memory usage: 129.2+ KB
0

Như chúng ta có thể thấy các tọa độ hình thành đa giác của chúng ta đã thay đổi từ độ thập phân sang mét. Hãy để xem những gì xảy ra nếu chúng ta chỉ gọi các hình học:meters. Let’s see what happens if we just call the geometries:

Như bạn có thể thấy, chúng ta có thể vẽ hình học trực tiếp trong màn hình và chúng ta có thể dễ dàng thấy sự khác biệt về hình dạng của hai hình học. Các biến


Name: WGS 84
Axis Info [ellipsoidal]:
- Lat[north]: Geodetic latitude [degree]
- Lon[east]: Geodetic longitude [degree]
Area of Use:
- name: World
- bounds: [-180.0, -90.0, 180.0, 90.0]
Datum: World Geodetic System 1984
- Ellipsoid: WGS 84
- Prime Meridian: Greenwich
1 và

Name: WGS 84
Axis Info [ellipsoidal]:
- Lat[north]: Geodetic latitude [degree]
- Lon[east]: Geodetic longitude [degree]
Area of Use:
- name: World
- bounds: [-180.0, -90.0, 180.0, 90.0]
Datum: World Geodetic System 1984
- Ellipsoid: WGS 84
- Prime Meridian: Greenwich
2 chứa một hình học hình dạng là

Name: WGS 84
Axis Info [ellipsoidal]:
- Lat[north]: Geodetic latitude [degree]
- Lon[east]: Geodetic longitude [degree]
Area of Use:
- name: World
- bounds: [-180.0, -90.0, 180.0, 90.0]
Datum: World Geodetic System 1984
- Ellipsoid: WGS 84
- Prime Meridian: Greenwich
3 trong trường hợp này. Chúng tôi có thể xác nhận điều này bằng cách kiểm tra loại:


RangeIndex: 486 entries, 0 to 485
Data columns [total 34 columns]:
 #   Column              Non-Null Count  Dtype   
---  ------              --------------  -----   
 0   addr:city           86 non-null     object  
 1   addr:country        57 non-null     object  
 2   addr:housenumber    88 non-null     object  
 3   addr:housename      4 non-null      object  
 4   addr:postcode       54 non-null     object  
 5   addr:street         89 non-null     object  
 6   email               2 non-null      object  
 7   name                81 non-null     object  
 8   opening_hours       8 non-null      object  
 9   operator            7 non-null      object  
 10  phone               8 non-null      object  
 11  ref                 1 non-null      object  
 12  url                 8 non-null      object  
 13  website             20 non-null     object  
 14  building            486 non-null    object  
 15  amenity             26 non-null     object  
 16  building:levels     162 non-null    object  
 17  building:material   2 non-null      object  
 18  building:min_level  4 non-null      object  
 19  height              17 non-null     object  
 20  landuse             2 non-null      object  
 21  office              5 non-null      object  
 22  shop                5 non-null      object  
 23  source              3 non-null      object  
 24  start_date          87 non-null     object  
 25  wikipedia           47 non-null     object  
 26  id                  486 non-null    int64   
 27  timestamp           486 non-null    int64   
 28  version             486 non-null    int64   
 29  tags                181 non-null    object  
 30  osm_type            486 non-null    object  
 31  internet_access     1 non-null      object  
 32  changeset           66 non-null     float64 
 33  geometry            486 non-null    geometry
dtypes: float64[1], geometry[1], int64[3], object[29]
memory usage: 129.2+ KB
1

Các hình học hình dạng này được sử dụng làm cấu trúc dữ liệu cơ bản trong hầu hết các gói GIS trong Python để trình bày thông tin hình học. Hình dạng về cơ bản là một trình bao bọc Python cho GEO được sử dụng rộng rãi thư viện [được viết bằng C ++] dưới mui xe của nhiều phần mềm GIS như QGIS, GDAL, cỏ, postgis, Google Earth, v.v. Các chức năng cho Python và đưa những người cuối cùng trở thành hình dạng sẽ tăng đáng kể hiệu suất của tất cả các hoạt động liên quan đến hình học trong hệ sinh thái Python [tiếp cận hiệu quả tương tự như postgis]. Một số trong những cải tiến này đã có thể được tìm thấy dưới mui xe của phiên bản địa lý mới nhất.

Tính toán khu vực

Một điều khá thú vị để biết khi làm việc với dữ liệu không gian, là


Name: WGS 84
Axis Info [ellipsoidal]:
- Lat[north]: Geodetic latitude [degree]
- Lon[east]: Geodetic longitude [degree]
Area of Use:
- name: World
- bounds: [-180.0, -90.0, 180.0, 90.0]
Datum: World Geodetic System 1984
- Ellipsoid: WGS 84
- Prime Meridian: Greenwich
4 của hình học. Trong địa chất, chúng ta có thể dễ dàng tính toán, ví dụ: Khu vực cho mỗi tòa nhà của chúng tôi bởi:


RangeIndex: 486 entries, 0 to 485
Data columns [total 34 columns]:
 #   Column              Non-Null Count  Dtype   
---  ------              --------------  -----   
 0   addr:city           86 non-null     object  
 1   addr:country        57 non-null     object  
 2   addr:housenumber    88 non-null     object  
 3   addr:housename      4 non-null      object  
 4   addr:postcode       54 non-null     object  
 5   addr:street         89 non-null     object  
 6   email               2 non-null      object  
 7   name                81 non-null     object  
 8   opening_hours       8 non-null      object  
 9   operator            7 non-null      object  
 10  phone               8 non-null      object  
 11  ref                 1 non-null      object  
 12  url                 8 non-null      object  
 13  website             20 non-null     object  
 14  building            486 non-null    object  
 15  amenity             26 non-null     object  
 16  building:levels     162 non-null    object  
 17  building:material   2 non-null      object  
 18  building:min_level  4 non-null      object  
 19  height              17 non-null     object  
 20  landuse             2 non-null      object  
 21  office              5 non-null      object  
 22  shop                5 non-null      object  
 23  source              3 non-null      object  
 24  start_date          87 non-null     object  
 25  wikipedia           47 non-null     object  
 26  id                  486 non-null    int64   
 27  timestamp           486 non-null    int64   
 28  version             486 non-null    int64   
 29  tags                181 non-null    object  
 30  osm_type            486 non-null    object  
 31  internet_access     1 non-null      object  
 32  changeset           66 non-null     float64 
 33  geometry            486 non-null    geometry
dtypes: float64[1], geometry[1], int64[3], object[29]
memory usage: 129.2+ KB
2


RangeIndex: 486 entries, 0 to 485
Data columns [total 34 columns]:
 #   Column              Non-Null Count  Dtype   
---  ------              --------------  -----   
 0   addr:city           86 non-null     object  
 1   addr:country        57 non-null     object  
 2   addr:housenumber    88 non-null     object  
 3   addr:housename      4 non-null      object  
 4   addr:postcode       54 non-null     object  
 5   addr:street         89 non-null     object  
 6   email               2 non-null      object  
 7   name                81 non-null     object  
 8   opening_hours       8 non-null      object  
 9   operator            7 non-null      object  
 10  phone               8 non-null      object  
 11  ref                 1 non-null      object  
 12  url                 8 non-null      object  
 13  website             20 non-null     object  
 14  building            486 non-null    object  
 15  amenity             26 non-null     object  
 16  building:levels     162 non-null    object  
 17  building:material   2 non-null      object  
 18  building:min_level  4 non-null      object  
 19  height              17 non-null     object  
 20  landuse             2 non-null      object  
 21  office              5 non-null      object  
 22  shop                5 non-null      object  
 23  source              3 non-null      object  
 24  start_date          87 non-null     object  
 25  wikipedia           47 non-null     object  
 26  id                  486 non-null    int64   
 27  timestamp           486 non-null    int64   
 28  version             486 non-null    int64   
 29  tags                181 non-null    object  
 30  osm_type            486 non-null    object  
 31  internet_access     1 non-null      object  
 32  changeset           66 non-null     float64 
 33  geometry            486 non-null    geometry
dtypes: float64[1], geometry[1], int64[3], object[29]
memory usage: 129.2+ KB
3

Chúng tôi đã tính toán khu vực bằng cách gọi


Name: WGS 84
Axis Info [ellipsoidal]:
- Lat[north]: Geodetic latitude [degree]
- Lon[east]: Geodetic longitude [degree]
Area of Use:
- name: World
- bounds: [-180.0, -90.0, 180.0, 90.0]
Datum: World Geodetic System 1984
- Ellipsoid: WGS 84
- Prime Meridian: Greenwich
4 là thuộc tính chứa thông tin về các khu vực của các tòa nhà được đo dựa trên các đơn vị bản đồ của dữ liệu. Do đó, trong trường hợp này vì dữ liệu của chúng tôi được chiếu trong Euref-Fin, các đơn vị mà chúng tôi lưu trữ trong cột

Name: WGS 84
Axis Info [ellipsoidal]:
- Lat[north]: Geodetic latitude [degree]
- Lon[east]: Geodetic longitude [degree]
Area of Use:
- name: World
- bounds: [-180.0, -90.0, 180.0, 90.0]
Datum: World Geodetic System 1984
- Ellipsoid: WGS 84
- Prime Meridian: Greenwich
6 là mét vuông. Nó rất quan trọng để luôn luôn ghi nhớ CRS khi tính toán các khu vực, khoảng cách, vv với hình học.square meters. It’s important to always keep in mind the CRS when calculating areas, distances etc. with geometries.

Tham gia không gian

Một chức năng GIS thường cần thiết, là có thể hợp nhất thông tin giữa hai lớp sử dụng vị trí làm


Name: WGS 84
Axis Info [ellipsoidal]:
- Lat[north]: Geodetic latitude [degree]
- Lon[east]: Geodetic longitude [degree]
Area of Use:
- name: World
- bounds: [-180.0, -90.0, 180.0, 90.0]
Datum: World Geodetic System 1984
- Ellipsoid: WGS 84
- Prime Meridian: Greenwich
7. Do đó, nó có phần tương tự như cách tiếp cận bảng nhưng vì hoạt động dựa trên hình học, nó được gọi là tham gia không gian. Tiếp theo, chúng ta sẽ xem làm thế nào chúng ta có thể tiến hành thông tin tham gia và hợp nhất không gian giữa hai lớp. Chúng tôi sẽ đọc tất cả các nhà hàng từ khu vực OSM cho Helsinki và kết hợp thông tin từ các nhà hàng đến tòa nhà cơ bản [các nhà hàng thường nằm trong các tòa nhà]. Chúng tôi sẽ một lần nữa sử dụng
from pyrosm import OSM, get_data

# Download data for Helsinki
fp = get_data["helsinki"]

# Initialize the reader object for Helsinki
osm = OSM[fp]
8 để đọc dữ liệu, nhưng lần này chúng tôi sẽ sử dụng hàm

Name: WGS 84
Axis Info [ellipsoidal]:
- Lat[north]: Geodetic latitude [degree]
- Lon[east]: Geodetic longitude [degree]
Area of Use:
- name: World
- bounds: [-180.0, -90.0, 180.0, 90.0]
Datum: World Geodetic System 1984
- Ellipsoid: WGS 84
- Prime Meridian: Greenwich
9:


RangeIndex: 486 entries, 0 to 485
Data columns [total 34 columns]:
 #   Column              Non-Null Count  Dtype   
---  ------              --------------  -----   
 0   addr:city           86 non-null     object  
 1   addr:country        57 non-null     object  
 2   addr:housenumber    88 non-null     object  
 3   addr:housename      4 non-null      object  
 4   addr:postcode       54 non-null     object  
 5   addr:street         89 non-null     object  
 6   email               2 non-null      object  
 7   name                81 non-null     object  
 8   opening_hours       8 non-null      object  
 9   operator            7 non-null      object  
 10  phone               8 non-null      object  
 11  ref                 1 non-null      object  
 12  url                 8 non-null      object  
 13  website             20 non-null     object  
 14  building            486 non-null    object  
 15  amenity             26 non-null     object  
 16  building:levels     162 non-null    object  
 17  building:material   2 non-null      object  
 18  building:min_level  4 non-null      object  
 19  height              17 non-null     object  
 20  landuse             2 non-null      object  
 21  office              5 non-null      object  
 22  shop                5 non-null      object  
 23  source              3 non-null      object  
 24  start_date          87 non-null     object  
 25  wikipedia           47 non-null     object  
 26  id                  486 non-null    int64   
 27  timestamp           486 non-null    int64   
 28  version             486 non-null    int64   
 29  tags                181 non-null    object  
 30  osm_type            486 non-null    object  
 31  internet_access     1 non-null      object  
 32  changeset           66 non-null     float64 
 33  geometry            486 non-null    geometry
dtypes: float64[1], geometry[1], int64[3], object[29]
memory usage: 129.2+ KB
4


RangeIndex: 486 entries, 0 to 485
Data columns [total 34 columns]:
 #   Column              Non-Null Count  Dtype   
---  ------              --------------  -----   
 0   addr:city           86 non-null     object  
 1   addr:country        57 non-null     object  
 2   addr:housenumber    88 non-null     object  
 3   addr:housename      4 non-null      object  
 4   addr:postcode       54 non-null     object  
 5   addr:street         89 non-null     object  
 6   email               2 non-null      object  
 7   name                81 non-null     object  
 8   opening_hours       8 non-null      object  
 9   operator            7 non-null      object  
 10  phone               8 non-null      object  
 11  ref                 1 non-null      object  
 12  url                 8 non-null      object  
 13  website             20 non-null     object  
 14  building            486 non-null    object  
 15  amenity             26 non-null     object  
 16  building:levels     162 non-null    object  
 17  building:material   2 non-null      object  
 18  building:min_level  4 non-null      object  
 19  height              17 non-null     object  
 20  landuse             2 non-null      object  
 21  office              5 non-null      object  
 22  shop                5 non-null      object  
 23  source              3 non-null      object  
 24  start_date          87 non-null     object  
 25  wikipedia           47 non-null     object  
 26  id                  486 non-null    int64   
 27  timestamp           486 non-null    int64   
 28  version             486 non-null    int64   
 29  tags                181 non-null    object  
 30  osm_type            486 non-null    object  
 31  internet_access     1 non-null      object  
 32  changeset           66 non-null     float64 
 33  geometry            486 non-null    geometry
dtypes: float64[1], geometry[1], int64[3], object[29]
memory usage: 129.2+ KB
5

Như chúng ta có thể thấy, khu vực OSM cho Helsinki chứa 1388 nhà hàng hoàn toàn. Như bạn có thể đoán, dữ liệu OSM khác xa với sự hoàn hảo về chất lượng của danh sách nhà hàng. Điều này là do tính chất tự nguyện của việc thêm thông tin vào OpenStreetMap và các nhà hàng thực tế [cũng như các tính năng POI khác] rất năng động, tức là các tiện nghi mới mở và đóng Ngày với những thay đổi đó [đây là một thách thức ngay cả đối với các công ty thương mại].

Tham gia dữ liệu từ các tòa nhà đến các nhà hàng có thể được thực hiện dễ dàng bằng cách sử dụng hàm

projected = buildings.to_crs[epsg=3067]
projected.crs
0 từ Geopandas:


RangeIndex: 486 entries, 0 to 485
Data columns [total 34 columns]:
 #   Column              Non-Null Count  Dtype   
---  ------              --------------  -----   
 0   addr:city           86 non-null     object  
 1   addr:country        57 non-null     object  
 2   addr:housenumber    88 non-null     object  
 3   addr:housename      4 non-null      object  
 4   addr:postcode       54 non-null     object  
 5   addr:street         89 non-null     object  
 6   email               2 non-null      object  
 7   name                81 non-null     object  
 8   opening_hours       8 non-null      object  
 9   operator            7 non-null      object  
 10  phone               8 non-null      object  
 11  ref                 1 non-null      object  
 12  url                 8 non-null      object  
 13  website             20 non-null     object  
 14  building            486 non-null    object  
 15  amenity             26 non-null     object  
 16  building:levels     162 non-null    object  
 17  building:material   2 non-null      object  
 18  building:min_level  4 non-null      object  
 19  height              17 non-null     object  
 20  landuse             2 non-null      object  
 21  office              5 non-null      object  
 22  shop                5 non-null      object  
 23  source              3 non-null      object  
 24  start_date          87 non-null     object  
 25  wikipedia           47 non-null     object  
 26  id                  486 non-null    int64   
 27  timestamp           486 non-null    int64   
 28  version             486 non-null    int64   
 29  tags                181 non-null    object  
 30  osm_type            486 non-null    object  
 31  internet_access     1 non-null      object  
 32  changeset           66 non-null     float64 
 33  geometry            486 non-null    geometry
dtypes: float64[1], geometry[1], int64[3], object[29]
memory usage: 129.2+ KB
6


RangeIndex: 486 entries, 0 to 485
Data columns [total 34 columns]:
 #   Column              Non-Null Count  Dtype   
---  ------              --------------  -----   
 0   addr:city           86 non-null     object  
 1   addr:country        57 non-null     object  
 2   addr:housenumber    88 non-null     object  
 3   addr:housename      4 non-null      object  
 4   addr:postcode       54 non-null     object  
 5   addr:street         89 non-null     object  
 6   email               2 non-null      object  
 7   name                81 non-null     object  
 8   opening_hours       8 non-null      object  
 9   operator            7 non-null      object  
 10  phone               8 non-null      object  
 11  ref                 1 non-null      object  
 12  url                 8 non-null      object  
 13  website             20 non-null     object  
 14  building            486 non-null    object  
 15  amenity             26 non-null     object  
 16  building:levels     162 non-null    object  
 17  building:material   2 non-null      object  
 18  building:min_level  4 non-null      object  
 19  height              17 non-null     object  
 20  landuse             2 non-null      object  
 21  office              5 non-null      object  
 22  shop                5 non-null      object  
 23  source              3 non-null      object  
 24  start_date          87 non-null     object  
 25  wikipedia           47 non-null     object  
 26  id                  486 non-null    int64   
 27  timestamp           486 non-null    int64   
 28  version             486 non-null    int64   
 29  tags                181 non-null    object  
 30  osm_type            486 non-null    object  
 31  internet_access     1 non-null      object  
 32  changeset           66 non-null     float64 
 33  geometry            486 non-null    geometry
dtypes: float64[1], geometry[1], int64[3], object[29]
memory usage: 129.2+ KB
7

changeset_lefttags_leftLonid_lefttimestamp_leftversion_leftLataddr:city_leftaddr:country_leftaddr:housenumber_left...cửa tiệmsource_rightstart_date_rightwikipedia_rightid_righttimestamp_rightversion_righttags_rightosm_type_rightchangeset_right01234{"Xe lăn": "Có"}13851385138613861387
0.0 {"Liên hệ: trang web": " //www.pikkuranska.com ...24.866842 25279508 0 0 60.208969 Không cóKhông cóKhông có...Không cóKhông có1957 Không có28175497 0 -1 ...{"Kiến trúc sư": "Eliel Muoniovaara", "Nguồn: Archi ...đường
0.0 Nan24.883369 27392509 0 0 60.181183 Không cóKhông cóKhông có...Không cóKhông cóKhông cóKhông có26405360 0 -1 Không có{"Kiến trúc sư": "Eliel Muoniovaara", "Nguồn: Archi ...đường
0.0 Nan25.042477 50812719 0 0 60.206657 {"Nhà vệ sinh: Xe lăn": "Có", "là: Tên": "Antin ...{"ẩm thực": "Nepal", "takeaway": "Có"}4 ...Không cóKhông cóKhông cóKhông có15505662 0 -1 Không cóđườngNan
0.0 {"Xe lăn": "Có"}25.030569 50818866 0 0 60.195324 HelsinkiKhông có14 ...Không cóKhông có1991 Không có10637173 0 -1 {"Tòa nhà: Bảo trì: Nhà điều hành": "Lassila & Tika ...đườngNan
0.0 {"Xe lăn": "Có"}25.041740 50820888 0 0 60.190361 Không cóKhông cóKhông có...Không cóKhông cóKhông cóKhông có47855788 0 -1 {"Tòa nhà: Bảo trì: Nhà điều hành": "Lassila & Tika ...đườngNan
...............................................................
Nan{"Xe lăn": "Có"}Nan583343945 0 -1 Nan{"Xe lăn": "Có"}Không có16 ...Không cóKhông cóKhông cóKhông có583343945 0 -1 {"Xe lăn": "Có"}đườngNan
Nan{"Xe lăn": "Có"}Nan583343945 0 -1 Nan{"Xe lăn": "Có"}Không có16 ...Không cóKhông cóKhông cóKhông có583343944 0 -1 Không cóđườngNan
Nan{"Xe lăn": "Có"}Nan625576876 0 -1 NanHelsinkiKhông có4 ...Không cóKhông cóKhông cóKhông có466092407 0 -1 Không cóđườngNan
Nan{"Xe lăn": "Có"}Nan625576876 0 -1 NanHelsinkiKhông có4 ...Không cóKhông cóKhông cóKhông có625576876 0 -1 {"Xe lăn": "Có"}đườngNan
NanKhông cóNan832179600 0 -1 Nan{"Xe lăn": "Có"}Không có262 ...Không cóKhông cóKhông cóKhông có832179600 0 -1 Không cóđườngNan

{"Xe lăn": "Có"}


RangeIndex: 486 entries, 0 to 485
Data columns [total 34 columns]:
 #   Column              Non-Null Count  Dtype   
---  ------              --------------  -----   
 0   addr:city           86 non-null     object  
 1   addr:country        57 non-null     object  
 2   addr:housenumber    88 non-null     object  
 3   addr:housename      4 non-null      object  
 4   addr:postcode       54 non-null     object  
 5   addr:street         89 non-null     object  
 6   email               2 non-null      object  
 7   name                81 non-null     object  
 8   opening_hours       8 non-null      object  
 9   operator            7 non-null      object  
 10  phone               8 non-null      object  
 11  ref                 1 non-null      object  
 12  url                 8 non-null      object  
 13  website             20 non-null     object  
 14  building            486 non-null    object  
 15  amenity             26 non-null     object  
 16  building:levels     162 non-null    object  
 17  building:material   2 non-null      object  
 18  building:min_level  4 non-null      object  
 19  height              17 non-null     object  
 20  landuse             2 non-null      object  
 21  office              5 non-null      object  
 22  shop                5 non-null      object  
 23  source              3 non-null      object  
 24  start_date          87 non-null     object  
 25  wikipedia           47 non-null     object  
 26  id                  486 non-null    int64   
 27  timestamp           486 non-null    int64   
 28  version             486 non-null    int64   
 29  tags                181 non-null    object  
 30  osm_type            486 non-null    object  
 31  internet_access     1 non-null      object  
 32  changeset           66 non-null     float64 
 33  geometry            486 non-null    geometry
dtypes: float64[1], geometry[1], int64[3], object[29]
memory usage: 129.2+ KB
8

Helsinki

...

{"Tòa nhà: Bảo trì: Nhà điều hành": "Lassila & Tika ...selecting data. We can e.g. select all buildings that intersect with restaurants by conducting the spatial join other way around, i.e. using the buildings as the left GeoDataFrame and the restaurants as the right GeoDataFrame:


RangeIndex: 486 entries, 0 to 485
Data columns [total 34 columns]:
 #   Column              Non-Null Count  Dtype   
---  ------              --------------  -----   
 0   addr:city           86 non-null     object  
 1   addr:country        57 non-null     object  
 2   addr:housenumber    88 non-null     object  
 3   addr:housename      4 non-null      object  
 4   addr:postcode       54 non-null     object  
 5   addr:street         89 non-null     object  
 6   email               2 non-null      object  
 7   name                81 non-null     object  
 8   opening_hours       8 non-null      object  
 9   operator            7 non-null      object  
 10  phone               8 non-null      object  
 11  ref                 1 non-null      object  
 12  url                 8 non-null      object  
 13  website             20 non-null     object  
 14  building            486 non-null    object  
 15  amenity             26 non-null     object  
 16  building:levels     162 non-null    object  
 17  building:material   2 non-null      object  
 18  building:min_level  4 non-null      object  
 19  height              17 non-null     object  
 20  landuse             2 non-null      object  
 21  office              5 non-null      object  
 22  shop                5 non-null      object  
 23  source              3 non-null      object  
 24  start_date          87 non-null     object  
 25  wikipedia           47 non-null     object  
 26  id                  486 non-null    int64   
 27  timestamp           486 non-null    int64   
 28  version             486 non-null    int64   
 29  tags                181 non-null    object  
 30  osm_type            486 non-null    object  
 31  internet_access     1 non-null      object  
 32  changeset           66 non-null     float64 
 33  geometry            486 non-null    geometry
dtypes: float64[1], geometry[1], int64[3], object[29]
memory usage: 129.2+ KB
9

{"Outdoor_Seating": "Có", "Takeaway": "Không", "Whee ...

  • projected = buildings.to_crs[epsg=3067]
    projected.crs
    
    3

  • projected = buildings.to_crs[epsg=3067]
    projected.crs
    
    4

  • projected = buildings.to_crs[epsg=3067]
    projected.crs
    
    5

{"fixme": "hình"}

...

# Output filepath
outfp = "data/buildings_copy.shp"
data.to_file[outfp]
0

# Output filepath
outfp = "data/buildings_copy.shp"
data.to_file[outfp]
1

{"Mô tả": "Suomen Paras Pihvipaikka - JA ...

# Output filepath
outfp = "data/buildings_copy.shp"
data.to_file[outfp]
2

Espoozoom in to our map by using a specific commands [


Name: ETRS89 / TM35FIN[E,N]
Axis Info [cartesian]:
- E[east]: Easting [metre]
- N[north]: Northing [metre]
Area of Use:
- name: Finland
- bounds: [19.08, 58.84, 31.59, 70.09]
Coordinate Operation:
- name: TM35FIN
- method: Transverse Mercator
Datum: European Terrestrial Reference System 1989
- Ellipsoid: GRS 1980
- Prime Meridian: Greenwich
1 and

Name: ETRS89 / TM35FIN[E,N]
Axis Info [cartesian]:
- E[east]: Easting [metre]
- N[north]: Northing [metre]
Area of Use:
- name: Finland
- bounds: [19.08, 58.84, 31.59, 70.09]
Coordinate Operation:
- name: TM35FIN
- method: Transverse Mercator
Datum: European Terrestrial Reference System 1989
- Ellipsoid: GRS 1980
- Prime Meridian: Greenwich
2 that control the axis of our visualization:

# Output filepath
outfp = "data/buildings_copy.shp"
data.to_file[outfp]
3

{"Liên hệ: trang web": "//loylyhelsinki.fi/", ...

# Output filepath
outfp = "data/buildings_copy.shp"
data.to_file[outfp]
4

Sipoo

# Output filepath
outfp = "data/buildings_copy.shp"
data.to_file[outfp]
5

1368 hàng × 76 cột

# Output filepath
outfp = "data/buildings_copy.shp"
data.to_file[outfp]
6

Như chúng ta có thể thấy từ trên, bây giờ chúng ta đã hợp nhất thông tin từ các tòa nhà đến các nhà hàng. Các hình học của

projected = buildings.to_crs[epsg=3067]
projected.crs
1 Geodataframe, tức là các nhà hàng được giữ theo mặc định là hình học.

Thêm thông tin¶

Để biết thêm thông tin, chúng tôi khuyên bạn nên kiểm tra các tài liệu khỏi tự động hóa các quy trình GIS -chi tiết [các điều của GIS] và địa lý -python -Corse [giới thiệu về python và phân tích dữ liệu với gấu trúc]. Ngoài ra, chúng tôi luôn khuyên bạn nên kiểm tra tài liệu mới nhất từ ​​các trang web của Thư viện:

  • Geopandas

  • pyrosm

  • matplotlib

  • gấu trúc

Dữ liệu không gian trong Python là gì?

Dữ liệu không gian, còn được gọi là dữ liệu không gian địa lý, dữ liệu GIS hoặc geodata, là một loại dữ liệu số xác định vị trí địa lý của một đối tượng vật lý, chẳng hạn như tòa nhà, đường phố, thị trấn, thành phố, một quốc gia hoặc các quốc gia khác Các đối tượng vật lý, sử dụng một hệ tọa độ địa lý.

Làm thế nào để bạn phân tích dữ liệu không gian?

Thông thường, phân tích không gian bao gồm năm giai đoạn chính: hiểu mục tiêu của bạn, chuẩn bị dữ liệu, chọn các công cụ và kỹ thuật phù hợp, thực hiện nghiên cứu và ước tính kết quả.Vì vậy, trước hết, điều quan trọng là phải tìm ra những gì bạn quan tâm để biết.understanding your goal, preparing data, choosing suitable tools and techniques, performing the research, and estimating results. So, first of all, it is important to figure out what you are interested to know.

Python được sử dụng như thế nào trong GIS?

Python là một ngôn ngữ kịch bản được tích hợp vào nhiều ứng dụng phần mềm GIS như ArcGIS và QGIS và được sử dụng để tự động hóa các tác vụ xử lý địa lý.Các tập lệnh Python về cơ bản là một tập lệnh dựa trên lệnh chứa các kiểu dữ liệu, câu lệnh và các chức năng tạo nên các hướng dẫn xử lý địa lý.to automate geoprocessing tasks. Python scripts are essentially a command-based script containing data types, statements, and functions that make up the geoprocessing instructions.

Python có phải là một phần mềm GIS không?

Các thư viện Python là phần mở rộng cuối cùng trong GIS vì nó cho phép bạn tăng cường chức năng cốt lõi của nó.Bằng cách sử dụng các thư viện Python, bạn có thể thoát ra khỏi khuôn là GIS và đi sâu vào một số khoa học dữ liệu nghiêm túc.Có hơn 200 thư viện tiêu chuẩn trong Python.Nhưng cũng có hàng ngàn thư viện của bên thứ ba. because it allows you to boost its core functionality. By using Python libraries, you can break out of the mold that is GIS and dive into some serious data science. There are 200+ standard libraries in Python. But there are thousands of third-party libraries too.

Bài Viết Liên Quan

Chủ Đề