GeoHey API.JS
JavaScript Library for GeoHey HTTP API
云端使用: <script src="//dist.geohey.com/g-api.js/latest/g-api.min.js"></script>
快速开始
Web应用
<!doctype html>
<html>
<head>
<meta charset='utf-8'>
</head>
<body>
<script src="g-api.min.js"></script>
<script>
var GAPI = require('GAPI');
GAPI.init('OGJ9OGI4YzAyNmJhNDI3Y2FmOWRmNjBlMTdhZiM4NmM'); // 浏览器访问凭证
GAPI.geocoding.geocode('鼓楼', {
admin: '北京'
}, function(data) {
console.log(data);
}, function(error) {
console.error(error);
});
</script>
</body>
</html>
NodeJS应用
cd g-api-node
npm install
var GAPI = require('./g-api-node/main.js');
GAPI.init('MzU0MTJjYzc4NDQxNDg1ZDgwMWEwZjQyNjBjMTVhNmQ'); // 服务器访问凭证