Code Monkey home page Code Monkey logo

coordtransform_py's Introduction

#坐标转换python版本 之前提供了js版本的坐标转换工具,现在提供一下python版本的给有需要的人,希望能对大家有用 #使用方法

  1. 由于代码里面使用了requests来请求百度geocode接口,因此需要这个功能的童鞋请务必先安装requests模块,可以借助pip或者easy_install来安装
pip install requests

or

easy_install requests
  1. 仅仅安装requests模块是不够的,童鞋还需要将代码内的
key = 'your key here'  # 这里填写你的百度开放平台的key

中的key替换成你自己百度地图开放平台的key,不清楚的童鞋可移步百度地图开放平台去申请一个key

#示例

	lng = 128.543
    lat = 37.065
    result1 = gcj02tobd09(lng, lat)
    result2 = bd09togcj02(lng, lat)
    result3 = wgs84togcj02(lng, lat)
    result4 = gcj02towgs84(lng, lat)
    result5 = geocode('北京市朝阳区朝阳公园')
    print result1, result2, result3, result4, result5

#sometips 代码最后写了一些示例代码,不需要的同学可以删掉,完全可以作为一个坐标转换模块引用到大家的项目中

coordtransform_py's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.