将.osm转换为.map之后,Web应用程序中的离线地理地图 [英] Offline Geographical Maps in Web Application after converting .osm to .map

查看:126
本文介绍了将.osm转换为.map之后,Web应用程序中的离线地理地图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于在Web应用程序中提供离线地图,我有非常基本的要求. 我的Web应用程序无法访问Internet,因此完全排除了所有用于显示地图的在线API.

I have this very basic requirement for providing offline maps in my web application. My web-application cannot access internet and hence all online API's for showing map is ruled out completely.

研究完成后,我下载了.osm.pbf格式的文件以查找所需的位置(例如,特定城市). 我

After doing research,I downloaded the .osm.pbf format file for the desired location(Say a particular city). I

已将.osm.pbf转换为.osm文件

converted .osm.pbf to .osm file

下一步,我使用此.osm文件生成了图块.

Next step I generated tiles using this .osm file.

磁贴存储在我的本地目录中.

The tiles are stored on my local directory.

我的最后一步是将这些磁贴显示为我内部网络浏览器中的地图 应用程序(Java EE)并根据纬度和经度放置标记 一个地方.

My final Step is to show these tiles as a map in web-browser inside my application (Java EE) and place a marker given the latitude and longitude of a place.

这是我必须在离线地图中显示的唯一要求.

This is the only requirement I have to show inside the offline map.

我有一个特定城市的图块.但是我不知道如何使用它并显示离线地图.

I have the tile for a particular city.But I don't know how to use it and show offline map..

用离线"一词,我的意思是,该应用程序托管在以下位置的Intranet上: 应用服务器,在任何情况下都不能访问互联网 提供.

By the term offline I mean, the application is hosted on Intranet on application server and under no circumstances internet access is provided.

亲切的向导.

推荐答案

您快到了.

将传单.js和.css文件保存在本地.

Save the leaflet .js and .css files locally.

  • http://leafletjs.com/dist/leaflet.css
  • http://leafletjs.com/dist/leaflet.js

请参阅此基本示例的源代码: http://leafletjs.com/examples /quick-start-example.html

See the source code of this basic example: http://leafletjs.com/examples/quick-start-example.html

按照说明将.css,.js路径更改为本地副本,并将tileLayer路径更改为本地.

Change the .css, .js paths to your local copies, and the tileLayer path to local as described.

查看标记的代码:

L.marker([51.5, -0.09]).addTo(map)
            .bindPopup("<b>Hello world!</b><br />I am a popup.").openPopup();

我猜这就是您所需要的.如有必要,请删除其他多边形和click-show-lat-long函数.

I'm guessing that's what you need. Remove the other polygons and the click-show-lat-long function if necessary.

如果您希望地图全屏显示,请将<div..标记更改为100%.

If you want the map to be full-screen, change the <div.. tag to 100%.

<div id="map" style="width: 100%; height: 100%"></div>

这篇关于将.osm转换为.map之后,Web应用程序中的离线地理地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆