dtoolkit.geoaccessor.geoseries.cncrs_offset#
- dtoolkit.geoaccessor.geoseries.cncrs_offset(s: GeoSeries, /, from_crs: Literal['wgs84', 'gcj02', 'bd09'], to_crs: Literal['wgs84', 'gcj02', 'bd09']) GeoSeries[source]#
Fix the offset of the coordinates in China.
Details see: Restrictions on geographic data in China.
The following CRS could be transformed:
WGS-84toGCJ-02.WGS-84toBD-09.GCJ-02toWGS-84.GCJ-02toBD-09.BD-09toWGS-84.BD-09toGCJ-02.
- Parameters:
- from_crs, to_crs{‘wgs84’, ‘gcj02’, ‘bd09’}
The CRS of the input and output.
- Returns:
- GeoSeries
Replaced original geometry.
- Raises:
- ValueError
If the CRS is not
ESGP:4326.
See also
Examples
>>> import dtoolkit.geoaccessor >>> import pandas as pd >>> df = pd.DataFrame( ... { ... "x": [114.21892734521, 128.543, 1], ... "y": [29.575429778924, 37.065, 1], ... }, ... ).from_xy("x", "y", crs=4326) >>> df x y geometry 0 114.218927 29.57543 POINT (114.21893 29.57543) 1 128.543000 37.06500 POINT (128.543 37.065) 2 1.000000 1.00000 POINT (1 1) >>> df.cncrs_offset(from_crs="bd09", to_crs="gcj02") x y geometry 0 114.218927 29.57543 POINT (114.21243 29.56938) 1 128.543000 37.06500 POINT (128.53659 37.05875) 2 1.000000 1.00000 POINT (0.99349 0.99399)