问题描述
我多次使用过Google地图,但是对于有什么疑问。
在开始任何形式的编码之前,这里有几个问题出现在我脑海里,
- 为什么会我使用OpenLayers而不是Google Maps?
- 无论如何
- 您是否遇到任何您绝对不推荐使用的情况OpenLayers?
- 我在;没有多少答案。这是否意味着这个解决方案用得不多?对于那些已经使用过OpenLayers的人们来说,这是否会成为项目长期可行性的问题? 我可能遇到的常见陷阱/问题?
- 使用JavaScript框架怎么样?我已经看到它使用,并且我知道Prototype,所以这样可以。但是如何使用等其他内容? (与Prototype不兼容,BTW)
- 是否有速度和性能相关的问题?我需要我的应用程序具有响应能力,并且不能等待几个小时才能显示地图。
- 是否有许多地图可用,还是有很多人失踪?
- 也就是说,我在法国,需要我的申请至少在大城市工作......这样好吗?
- 如果没有,很容易找到OpenLayers的图层和可视化并整合它们?
- 有没有一种API来显示道路?
- 例如,显示只有单向的道路。
- 如果是,我该怎么做?我必须有一些包含这些道路信息的文件,然后自行显示它们吗? 你知道OpenLayers的任何优秀教程吗?
我还没有尝试过,这些只是蓝色的问题...
解决方案这是一个非常棒的问题!我是一名专业的OpenLayers开发人员和粉丝,因此我会从这个角度解决您的问题。
为什么我会使用OpenLayers而不是Google Maps?
- 灵活性:您不受限于任何特定的地图提供者或技术。您可以随时更改,而无需重新编写整个代码。 Google,Yahoo,Microsoft,WMS,ArcGIS Server,MapServer等都支持开箱即用。
- 矢量支持:更好地支持点,多义线和多边形。 >
- 控制:您可以添加任何可能需要的新功能。我亲自为OpenLayers编写了三个插件,其中两个已经或将会成为源代码的一部分。
- 调试:当您可以逐步完成源代码时,更容易调试! li>
我完全不担心项目的长期可行性。它是首要的开源客户端映射库。
是否有任何常见的陷阱/问题可能会遇到?
- 我遇到的最大陷阱是与Web Mercator(Google)投影一起工作。显示常用和真实投影中的矢量数据可能是一种痛苦,例如转换为使用Google,Yahoo和Microsoft基本地图的OpenLayers地图。这些示例是您的朋友。
JavaScript框架兼容性
- 我为我的所有工作使用jQuery框架,而唯一的问题是在OpenLayers之后引用jQuery。除此之外,它一直是顺风顺水。
- 表现非常棒!唯一的问题将是你的地图服务器或向你的地图添加太多的矢量。
地点?
- 就像我说过的,你可以在世界任何地方使用任何来源的底图。 >
是否有任何API显示道路?
- 我会检查CloudMade!已将项目转换为地图平铺服务并允许自定义样式。我相信你可以用一种特殊的方式来设计单行道(按照你的例子)。 。
您知道OpenLayers的任何优秀教程吗? 我不知道任何教程,但是 OpenLayers示例
我希望这很有用。如果您有任何问题,我将在Stack Overflow上!
I have used Google Maps a couple of times, but what wondering about OpenLayers.
Before starting any kind of coding, here are a couple of questions that come to my mind,
- Why would I use OpenLayers instead of Google Maps?
- Except for its OSS licence, anyway
- Did you encounter any situation in which you'd recommend absolutly not using OpenLayers?
- I did a search about "OpenLayers" on Stack Overflow; there are not many answers. Does it mean this solution is not used much? Could it be a problem for long-term viability of the project?
- For those of you who have already used OpenLayers: are there any common pitfalls / problems I may encounter?
- What about using a JavaScript Framework with it? I've seen it's using Prototype, and I know Prototype, so that would be OK. But what about using something else like MooTools? (Which is not compatible with Prototype, BTW)
- Are there any kind of speed and performance related problems? I need my application to be responsive and can't wait hours to get a map displayed.
- Are there maps available for many places, or are there lots of those missing?
- That is, I'm in France, and need my application to work at least for big cities... Will that be OK?
- if not, is it easy to find layers and visualisations for OpenLayers and integrate them?
- Is there any kind of API to display roads?
- For instance, to show roads that are one-way only.
- If yes, how can I do that? Do I have to have some kind of file containing those roads information, and, then, display them on the map by myself?
- Do you know any good tutorial to OpenLayers?
I have not tried it yet, those are just out of the blue questions...
These are a really great questions! I'm a professional OpenLayers developer and fan, so I'll address your questions from that perspective.
Why would I use OpenLayers instead of Google Maps?
- Flexiblity: You are not tied to any particular map provider or technology. You can change anytime and not have to rewrite your entire code. Google, Yahoo, Microsoft, WMS, ArcGIS Server, MapServer, etc. are all supported out of the box.
- Vector Support: Better support for points, polylines, and polygons.
- Control: You have the ability to add any new features that you may need. I've personally written three plugins for OpenLayers, two of which are or will be part of the source.
- Debugging: Much easier to debug when you can step through the source code!
I would not worry at all about the long-term viability of the project. It is the premier open source client-side mapping library.
Are there any common pitfalls / problems I may encounter?
- The biggest pitfall I've run into is working with the Web Mercator (Google) projection. It can be a pain to display vector data that is in a common and real projection like WGS 84 into an OpenLayers map using Google, Yahoo, and Microsoft base maps. The examples are your friend.
JavaScript Framework Compatibility
- I use the jQuery framework for all of my work, and the only problem I've had is referencing jQuery after OpenLayers. Other than that, it's been smooth sailing.
- Performance is great! The only issues will be with your map server or adding too many vectors to your map.
Are there maps available for many places?
- Like I said, you can use basemaps from just about any source for anywhere in the world.
Is there any kind of API to display roads?
- I'd check out CloudMade! The have converted the OpenStreetMap project into a map tile service and allow custom styling. I believe that you can style one-way streets (per your example) a particular way. The CloudMade Developer Zone.
Do you know any good tutorial to OpenLayers?
- I don't know any tutorials, but there are a ton of examples in OpenLayers Examples
I hope this is useful. And I'm around Stack Overflow if you have any questions!
这篇关于OpenLayers与谷歌地图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!