标签存档: Google Maps

体验Google翻译的正确性

下面这段英文摘自英语维基百科 Google Earth 3D imagery:

Google Earth shows 3D building models in some cities, including 
photorealistic 3D imagery. The first 3D buildings in Google 
Earth were created using 3D modeling applications such as 
SketchUp and, beginning in 2009, Building Maker,[19] and 
were uploaded to Google Earth via the 3D Warehouse. In June 
2012, Google announced that it would be replacing user-generated 
3D buildings with an auto-generated 3D mesh.[20] This would be 
phased in, starting with select larger cities, with the notable 
exception of cities such as London and Toronto which required 
more time to process detailed imagery of their vast number of 
buildings. The reason given is to have greater uniformity in 
3D buildings, and to compete with Nokia Here and Apple Maps, 
which were already using this technology. The coverage began 
that year in 21 cities in four countries.[21] By early 2016, 
3D imagery had been expanded to hundreds of cities in over 40 
countries, including every U.S. state and encompassing every 
continent except Antarctica.
In 2009, in a collaboration between Google and the Museo del 
Prado in Madrid, the museum selected 14 of its paintings to 
be photographed and displayed at the resolution of 14,000 
megapixels inside the 3D version of the Prado in Google Earth 
and Google Maps.[22][23]

经过 https://translate.google.cn  翻译后:

`4]EXJ[{4O{}F9K({]2~A0M.png

可见Google翻译对自然语言处理的准确度还是非常高的。

用OpenLayers实例化一幅地图

        openlayers是一个非常大而复杂,强大和灵活的JS框架。
        在OpenLayers一个主要的概念就是Map,Map可以包含一些图层,这些图层可以是矢量的也可以使栅格的。
        每个图层的数据源可以是图片,也可以是kml文件等。当然Map也包含一些控件,主要是交互所用的,比如 平移 缩放,要素的选择等等。
        现在我们开始学习OpenLayers的使用。
        1.创建一个简单的电子地图应用。
        你要创建一个电子地图应用,首先要创建一个地图。本教程将引导你创建一个简单的电子地图应用。
        当然一些必要的基础知识是需要的,比如 HTML,CSS ,Javascript 等是要学习的,OpenLayers是主要是通过HTML和Javascript编写的,所以我们得有一个编辑器。
        这里我们使用EditPlus ,当然你可以选择更好的一些编辑器,他们会高亮显示语法和自动提示功能。
        2.我们首先下载openlayers的源码,下载地址:://github.com/openlayers/openlayers/releases/download/v4.1.1/v4.1.1-dist.zip,解压里面的内容。
        3.下面创建一个 空的index.html文件。

        写入如下代码:

<!doctype html>
<html>
  <head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="css/ol.css" type="text/css">
<link rel="stylesheet" href="css/main.css" type="text/css">
<script src="js/jquery1.8.3.min.js" type="text/javascript"></script>
    <!-- <script src="js/ol.js" type="text/javascript"></script> -->
<script src="js/ol-debug.js" type="text/javascript"></script>
<script src="js/main.js" type="text/javascript"></script>
    <title>OpenLayers example</title>
  </head>
  <body>
    <h2>Map Test</h2>
    <div id="map"></div>
  </body>
</html>

        4.在index.html目录下创建一个css和js文件夹,分别放入ol.css、ol.js和ol-debug.js和jquery.js,在css目录中另外创建main.css以及在js文件下创建main.js。用文本编辑器分别打开main.css和main.js,在main.css写入:

.map {
	position:absolute;
    height: 600px;
    width: 100%;
	border: 1px red solid; 
  }

        以及在main.js中写入:

$(function(){	 
	var view = new ol.View({
		center: ol.proj.fromLonLat([114.42, 30.52]),
		zoom: 9,
		maxZoom:18,
		minzoom:2
	});	
	
	var mapquest = new ol.layer.Tile({
		source: new ol.source.OSM(),
		visible:true,
		name:'mapquest'	
	});		
	var map = new ol.Map({
			target: 'map',
			controls:ol.control.defaults().extend([
				new ol.control.ScaleLine(),
				new ol.control.ZoomSlider()
			]),
			layers: [mapquest],
			view: view
		  });		  	  		  
})

        5.用浏览器打开index.html,就可以看到刚才创建的地图了。