Google map接口不能用了,换成Nokia here map!

大家都知道,谷歌最近可以说是完全退出中国了,除了谷歌地图可以正常使用,其它的都需要翻墙,而且,谷歌地图不是地图接口,供开发人员使用的Google map api已经不能使用了,当然也有办法可以使用,我曾经换过一个接口地址,可以使用接口开发,不过这是个老版本的接口,api解释也没有。后来想想,算了吧,就算现在解决了api问题,哪天谷歌又作死,天朝再强制封锁,那也有不能使用!然后就找替代者:雅虎地图、bing map、here map(不要问我为啥不用百度或者高德,出了中国,这些国内的地图就是白白一片)。

说说这三个地图。雅虎:其实很一般,就连雅虎的高层都说自己用的是谷歌地图,雅虎心思不在地图上,没有多少投入,然后api接口这些压根就找不到。bing map:微软的东西,可以使用,但是数据有限,始终感觉太粗糙了!原本我以为bing map也是nokia用的地图,毕竟wp操作系统就是微软的,唉,有点想当然了!后来发现Nokia的地图here map跟bing map不是一个东西,然后就看看!看完之后才知道,Google map!bye!以后就用here map!Nokia把手机业务卖给了微软,但是没把here map一起卖了!自家保留了!这是好事!

here map 跟Google map完全有一拼!丝毫不差于谷歌,谷歌有的Nokia也有,接口调用也比较简单,就是方法不一样而已,还有就是,Nokia的here map对api的解释比较欠缺!没有谷歌写得详细,这也可以理解,毕竟谷歌有自己的android系统,它对各种开发接口的解释比较有经验,至于here map,还有待于完善,或许Nokia自己完善,或许开发者帮他完善。

当然,here map也可以在android上使用!同样的使用webview控件来加载就可以,方式和我之前写过的那篇一样,这里我只给提供一个最基本的here map,html的源代码。

heremap.html如下:

<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="X-UA-Compatible" content="IE=7; IE=EmulateIE9; IE=10" />
		<base href="http://developer.here.com/apiexplorer/examples/api-for-js/getting-started/basic-map-with-components.html" />
		<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
		<title>HERE Maps API for JavaScript Example: Basic map with components</title>
		<meta name="description" content="How to get a basic map with all UI components enabled"/>
		<meta name="keywords" content="basiccomponents, getting started, basic map, components"/>
		<!-- For scaling content for mobile devices, setting the viewport to the width of the device-->
		<meta name=viewport content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>

		<link rel="icon" href="http://developer.here.com/apiexplorer/examples/templates/common/favicon.ico" type="image/x-icon" />
		<!-- Styling for example container (NoteContainer & Logger)  -->
		<link rel="stylesheet" type="text/css" href="http://developer.here.com/apiexplorer/examples/templates/js/exampleHelpers.css"/>
		<!-- By default we add ?with=all to load every package available,
			it's better to change this parameter to your use case. 
			Options ?with=maps|positioning|places|placesdata|directions|datarendering|all -->
		<script type="text/javascript" charset="UTF-8" src="http://js.cit.api.here.com/se/2.5.4/jsl.js?with=all"></script>
		<!-- JavaScript for example container (NoteContainer & Logger)  -->
		<script type="text/javascript" charset="UTF-8" src="http://developer.here.com/apiexplorer/examples/templates/js/exampleHelpers.js"></script>
		<style type="text/css">
			html {
				overflow:hidden;
			}

			body {
				margin: 0;
				padding: 0;
				overflow: hidden;
				width: 100%;
				height: 100%;
				position: absolute;
			}

			#mapContainer {
				width: 100%;
				height: 100%;
				left: 0;
				top: 0;
				position: absolute;
			}
		</style>
	</head>
	<body>
		<div id="mapContainer"></div>
		<div id="uiContainer"></div>
		<script type="text/javascript" id="exampleJsSource">
/*	Setup authentication app_id and app_code 
*	WARNING: this is a demo-only key
*	please register for an Evaluation, Base or Commercial key for use in your app.
*	Just visit http://developer.here.com/get-started for more details. Thank you!
*/
nokia.Settings.set("app_id", "DemoAppId01082013GAL"); 
nokia.Settings.set("app_code", "AJKnXv84fjrb0KIHawS0Tg");
// Use staging environment (remove the line for production environment)
nokia.Settings.set("serviceMode", "cit");

// Get the DOM node to which we will append the map
var mapContainer = document.getElementById("mapContainer");
// Create a map inside the map container DOM node
var map = new nokia.maps.map.Display(mapContainer, {
	// initial center and zoom level of the map
	center: [52.51, 13.4],
	zoomLevel: 10,
	components: [
		// ZoomBar provides a UI to zoom the map in & out
		new nokia.maps.map.component.ZoomBar(), 
		// We add the behavior component to allow panning / zooming of the map
		new nokia.maps.map.component.Behavior(),
		// Creates UI to easily switch between street map satellite and terrain mapview modes
		new nokia.maps.map.component.TypeSelector(),
		// Creates a toggle button to show/hide traffic information on the map
		new nokia.maps.map.component.Traffic(),
		// Creates a toggle button to show/hide public transport lines on the map
		new nokia.maps.map.component.PublicTransport(),
		// Creates a toggle button to enable the distance measurement tool
		new nokia.maps.map.component.DistanceMeasurement(),
		// Shows a min-map in the bottom right corner of the map
		new nokia.maps.map.component.Overview(),
		/* Shows a scale bar in the bottom right corner of the map depicting
		 * ratio of a distance on the map to the corresponding distance in the real world
		 * in either kilometers or miles
		 */ 
		new nokia.maps.map.component.ScaleBar(),
		/* Positioning will show a set "map to my GPS position" UI button
		 * Note: this component will only be visible if W3C geolocation API
		 * is supported by the browser and if you agree to share your location.
		 * If you location can not be found the positioning button will reset
		 * itself to its initial state
		 */
		new nokia.maps.positioning.component.Positioning(),
		// Add ContextMenu component so we get context menu on right mouse click / long press tap
		new nokia.maps.map.component.ContextMenu(),
		// ZoomRectangle component adds zoom rectangle functionality to the map
		new nokia.maps.map.component.ZoomRectangle()
	]
});

/* We create a UI notecontainer for example description
 * NoteContainer is a UI helper function and not part of the Maps API for JavaScript
 * See exampleHelpers.js for implementation details 
 */
var noteContainer = new NoteContainer({
	id: "basicMapWithComponentsUi",
	parent: document.getElementById("uiContainer"),
	title: "Basic map example with components",
	content:
		'<p>This example shows how to create a basic pannable map with a  ' +
		'map type selector, scalebar, public transport button, ' +
		'mini map, positioning and a zoombar.</p>'
});
		</script>
	</body>
</html>

这是Nokia的基本地图,效果可以和谷歌的媲美!同样可以使用js来实现对地图的操作,然后再从android上调用就可以了!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值