Skip to main content

china mars coordinate convertor.

Project description

# China Coordinate Convertor


[中国火星坐标](https://en.wikipedia.org/wiki/Restrictions_on_geographic_data_in_China)转换命令行工具,用于`WGS-84`(未偏移坐标), `GCJ-02`(国家测绘局、高德、谷歌中国地图), `BD-09`(百度坐标系)三者之间的互相转换,支持文件格式:
- ESRI Shapefile
- GeoJSON

<img src="./assets/all.jpg" width = "100%" height = "100%" alt="图片名称" align=center />

## 安装
推荐使用:
`pip install coord-convert`

或者也可以从源码安装:
```
git clone https://github.com/sshuair/coord-convert.git
pip install -r requirements.txt
python setup.py install
```

## 依赖
- python3
- fiona
- tqdm
- click

## 使用方法
>注意:火星坐标转换是针对经纬度的转换,因此在进行转换前需要将坐标转换成经纬度;比如web墨卡托(3857)等投影坐标系需要先转成经纬度坐标(4326)

### Python API调用
在python程序中调用相应的坐标转换接口

```python
from coord_convert.transform import wgs2gcj, wgs2bd, gcj2wgs, gcj2bd, bd2wgs, bd2gcj
lon, lat = 120, 40
gcj_lon, gcj_lat = wgs2gcj(lon, lat)
bd_lon, bd_lat = wgs2bd(lon, lat)
print(gcj_lon, gcj_lat) # the result should be: 120.00567568355486 40.0013047896019

```


### 命令行调用
火星坐标转换还支持命令行直接对shp、geojson等文件进行转换,比如

```bash
~/temp > coord_covert gcj2wgs tests/data/Polyline/polyline.geojson aa.geojson
100%|██████████████████████████████████████████████████████| 219/219 [00:00<00:00, 550.93it/s]
```

更详细的用法:
```
convert input china coordinate to another.

Arguments:
convert_type {string} -- [coordinate convert type, e.g. wgs2bd]

wgs2gcj : convert WGS-84 to GCJ-02
wgs2bd : convert WGS-84 to DB-09
gcj2wgs : convert GCJ-02 to WGS-84
gcj2bd : convert GCJ-02 to BD-09
bd2wgs : convert BD-09 to WGS-84
bd2gcj : convert BD-09 to GCJ-02

src_path {string} -- [source file path]
dst_path {string} -- [destination file path]


Example:
coord_covert wgs2gcj ./examples/data/polygon/polygon_wgs.shp ~/temp/polygon_gcj.shp

```




Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

coord-convert-0.2.tar.gz (4.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

coord_convert-0.2.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

coord_convert-0.2-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file coord-convert-0.2.tar.gz.

File metadata

  • Download URL: coord-convert-0.2.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5

File hashes

Hashes for coord-convert-0.2.tar.gz
Algorithm Hash digest
SHA256 4afa6ffb94c7ca11c6d51db925b29ff7108449c972b56729121c7d8d27644555
MD5 3b593b374030897bc7bf78da423a7752
BLAKE2b-256 95c3c58a72a10f221589ebb701c02234a9022240b95d080c55c3ae72cb768af2

See more details on using hashes here.

File details

Details for the file coord_convert-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: coord_convert-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.9

File hashes

Hashes for coord_convert-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ceff14aaa524bc2b8f4cca4c89f970a9f881d20e5ee43df5590f350e58627ef4
MD5 b3a1675d93854638d3efcf52d4555741
BLAKE2b-256 389697495fe5002e953ef61767a9057c7443f65f2c8a92adcb4c3747f4b16f38

See more details on using hashes here.

File details

Details for the file coord_convert-0.2-py3-none-any.whl.

File metadata

  • Download URL: coord_convert-0.2-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5

File hashes

Hashes for coord_convert-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a7d25117f2717f6ba5c2649a7ca421f04af493adc8ad9f3bb51d150a4f9844fd
MD5 79ec578d173b921573559f1c1ea2490b
BLAKE2b-256 3ea522277402cfa110f1ef593050302aa42f405239a3b2c8c6bd61d9d1a80c4d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page