To start this assignment, accept the GitHub classroom assignment, and clone your own repository, e.g., in a CSC Noppe instance. Make sure you commit and push all changes you make (you can revisit instructions on how to use git and the JupyterLab git-plugin on the website of the Geo-Python course.
To preview the exercise without logging in, you can find the open course copy of the course’s GitHub repository at github.com/Automating-GIS-processes-II-2024/Exercise-3. Don’t attempt to commit changes to that repository, but rather work with your personal GitHub classroom copy (see above).
上記は、GitHub classroomに関する話で関係なさそうなので、省略します。
Hints
Coordinate reference systems
Note
Remember the difference between defining a CRS and re-projecting a layer into a new CRS! Before re-projecting, the layer should have a valid CRS definition, which you can check like this: data.crs.
CRSを定義すること、CRSを再投影すること、この違いを押さえておきましょう!
再投影の前に、投影のデータには妥当なCRSが定義されているべきです。data.crs
で確認できます。
To define a projection, assign a new CRS to a geo-data frame’s crs property:
geoDataFrame
のcrsプロパティに新しいCRSを設定します。
data.crs = pyproj.CRS("EPSG:4326")
This will update the metadata, only. The actual coordinate values will remained unmodified. Use this only if the original CRS definition is missing or invalid.
これはメタデータが更新されるだけで、実際の座標値は更新されません。
なので、CRSが未定義、または、妥当でない場合のみ使うことになります。
To re-project a geopandas.GeoDataFrame, use its
to_crs()
method:
geoDataFrame
を再投影するには、to_crs()
メソッドを使います。
data = data.to_crs("EPSG:4326")
This will actually transform the geometry features of the data frame, AND re-define the CRS definition stored in the .crs property.
この場合は、geoDataFrame
にある地物の座標は変換されます。また、geoDataFrame
のcrsプロパティにも再定義されたCRSが設定されます。
次回は以下です。