Skip to main content

A Python library about map coordinations

Project description

MapCoords
======

|Python2| |Python3|

MapCoords is an open source api for map coordinates.

coordtransform module can be used to transform coordinates among some common coordinate systems.

**Installation**

.. code:: bash

pip install MapCoords

**coordtransform**

.. code:: python

from MapCoords.coordtransform import *

# test wgs84_to_gcj02_point, Amap api: http://lbs.amap.com/api/webservice/guide/api/convert
print(wgs84_to_gcj02_point(116.481499, 39.990475)) # [116.48758599999999, 39.991754]
print(wgs84_to_gcj02_point([116.481499, 39.990475])) # [116.48758599999999, 39.991754]
print(wgs84_to_gcj02_point((116.481499, 39.990475))) # [116.48758599999999, 39.991754]
print(wgs84_to_gcj02_point(np.array([116.481499, 39.990475]))) # [116.48758599999999, 39.991754]
print(wgs84_to_gcj02_point(140, 60)) # [140, 60]

# test gcj02_to_bd09_point
print()
print(gcj02_to_bd09_point(116.487586, 39.991754)) # [116.49412, 39.997716]
print(gcj02_to_bd09_point([116.487586, 39.991754])) # [116.49412, 39.997716]
print(gcj02_to_bd09_point((116.487586, 39.991754))) # [116.49412, 39.997716]
print(gcj02_to_bd09_point(np.array([116.487586, 39.991754]))) # [116.49412, 39.997716]

# test wgs84_to_bd09_point
print()
print(wgs84_to_bd09_point(116.481499, 39.990475)) # [116.49412, 39.997716]
print(wgs84_to_bd09_point([116.481499, 39.990475])) # [116.49412, 39.997716]
print(wgs84_to_bd09_point((116.481499, 39.990475))) # [116.49412, 39.997716]
print(wgs84_to_bd09_point(np.array([116.481499, 39.990475]))) # [116.49412, 39.997716]

# test gcj02_to_wgs84_point
print()
print(gcj02_to_wgs84_point(116.487586, 39.991754)) # [116.481499, 39.990475000000004]
print(gcj02_to_wgs84_point([116.487586, 39.991754])) # [116.481499, 39.990475000000004]
print(gcj02_to_wgs84_point((116.487586, 39.991754))) # [116.481499, 39.990475000000004]
print(gcj02_to_wgs84_point(np.array([116.487586, 39.991754]))) # [116.481499, 39.990475000000004]

# test bd09_to_gcj02_point
print()
print(bd09_to_gcj02_point(116.49412, 39.997716)) # [116.487586, 39.991754]
print(bd09_to_gcj02_point([116.49412, 39.997716])) # [116.487586, 39.991754]
print(bd09_to_gcj02_point((116.49412, 39.997716))) # [116.487586, 39.991754]
print(bd09_to_gcj02_point(np.array([116.49412, 39.997716]))) # [116.48758599999999, 39.991754]

# test bd09_to_wgs84_point
print()
print(bd09_to_wgs84_point(116.49412, 39.997716)) # [116.481499, 39.990475000000004]
print(bd09_to_wgs84_point([116.49412, 39.997716])) # [116.481499, 39.990475000000004]
print(bd09_to_wgs84_point((116.49412, 39.997716))) # [116.481499, 39.990475000000004]
print(bd09_to_wgs84_point(np.array([116.49412, 39.997716]))) # [116.481499, 39.990475000000004]

# test wgs84_to_gcj02_array
print()
print(wgs84_to_gcj02_array(np.array([116.481499, 116.481499, 116.481499]),
np.array([39.990475, 39.990475, 39.990475])))
print(wgs84_to_gcj02_array([116.481499, 116.481499, 116.481499],
[39.990475, 39.990475, 39.990475]))

# test gcj02_to_bd09_array
print()
print(gcj02_to_bd09_array(np.array([116.487586, 116.487586, 116.487586]),
np.array([39.991754, 39.991754, 39.991754])))
print(gcj02_to_bd09_array([116.487586, 116.487586, 116.487586],
[39.991754, 39.991754, 39.991754]))

# test wgs84_to_bd09_array
print()
print(wgs84_to_bd09_array(np.array([116.481499, 116.481499, 116.481499]),
np.array([39.990475, 39.990475, 39.990475])))
print(wgs84_to_bd09_array([116.481499, 116.481499, 116.481499],
[39.990475, 39.990475, 39.990475]))


# test gcj02_to_wgs84_array
print()
print(gcj02_to_wgs84_array(np.array([116.487586, 116.487586, 116.487586]),
np.array([39.991754, 39.991754, 39.991754])))
print(gcj02_to_wgs84_array([116.487586, 116.487586, 116.487586],
[39.991754, 39.991754, 39.991754]))

# test bd09_to_gcj02_array
print()
print(bd09_to_gcj02_array(np.array([116.49412, 116.49412, 116.49412]),
np.array([39.997716, 39.997716, 39.997716])))
print(bd09_to_gcj02_array([116.49412, 116.49412, 116.49412],
[39.997716, 39.997716, 39.997716]))

# test bd09_to_wgs84_array
print()
print(bd09_to_wgs84_array(np.array([116.49412, 116.49412, 116.49412]),
np.array([39.997716, 39.997716, 39.997716])))
print(bd09_to_wgs84_array([116.49412, 116.49412, 116.49412],
[39.997716, 39.997716, 39.997716]))


.. |Python2| image:: https://img.shields.io/badge/python-2.7-ff69b4.svg
.. |Python3| image:: https://img.shields.io/badge/python-3.5-red.svg

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

MapCoords-0.1.4.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

MapCoords-0.1.4-py2.py3-none-any.whl (15.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file MapCoords-0.1.4.tar.gz.

File metadata

  • Download URL: MapCoords-0.1.4.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for MapCoords-0.1.4.tar.gz
Algorithm Hash digest
SHA256 cd33c479ebbb29987cdbf5ee664cd974985a1836a6ea61ed51b7fa5e0cf50203
MD5 b6ae82093c948f54490a5388c0e08522
BLAKE2b-256 5459a8f9c4083485b75cd85d2ead19f25c046fc3a2aee9df7f44d30ddfd7f3d7

See more details on using hashes here.

File details

Details for the file MapCoords-0.1.4-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for MapCoords-0.1.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 3b54710fa445f3e28056b21b9093ea356eb4995d5b9a01cb33bc376460686df8
MD5 3010a8263911c50725507053145acc14
BLAKE2b-256 163256ac5d0d408927ef43a40b53c992fe7b0a74a423fc42502eaf0174cfb7c3

See more details on using hashes here.

Supported by

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