【问题标题】:Leaflet map offline传单地图离线
【发布时间】:2016-11-01 09:39:21
【问题描述】:

我正在使用 Electron(使用 html 和 node.js 创建应用程序的 GitHub 工具)创建一个应用程序。 此应用程序将由一些未连接到互联网的计算机使用。 我需要显示地图并在其上搭配标记(我找到了 Leaflet),但所有地图服务都需要互联网。 使用 Open Street Maps,我可以导出 osm 文件,但找不到将其渲染到 Leaflet 中的方法,因为执行此操作的唯一节点库(mapbox-gl-native-master)需要 C++11 并且它提供我安装错误:

$ npm install mapbox-gl-native

> mapbox-gl-native@3.2.1 preinstall /home/dpd-/node_modules/.staging/mapbox-gl-native-eb973ff7
> npm install node-pre-gyp

npm ERR! Linux 4.4.0-24-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "node-pre-gyp"
npm ERR! node v4.2.6
npm ERR! npm  v3.5.2

npm ERR! Cannot read property 'target' of null
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /home/dpd-/node_modules/.staging/mapbox-gl-native-eb973ff7/npm-debug.log
npm WARN enoent ENOENT: no such file or directory, open '/home    /dpd-/package.json'
npm WARN dpd- No description
npm WARN dpd- No repository field.
npm WARN dpd- No README data
npm WARN dpd- No license field.
npm ERR! Linux 4.4.0-24-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "mapbox-gl-native"
npm ERR! node v4.2.6
npm ERR! npm  v3.5.2
npm ERR! code ELIFECYCLE

npm ERR! mapbox-gl-native@3.2.1 preinstall: `npm install node-pre-gyp`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the mapbox-gl-native@3.2.1 preinstall script 'npm     install node-pre-gyp'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the mapbox-gl-native package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm install node-pre-gyp
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs mapbox-gl-native
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls mapbox-gl-native
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/dpd-/npm-debug.log

【问题讨论】:

  • 使用离线工作的网络技术编写地图应用程序并非易事。您可能想在 gis.stackexchange.com 上询问

标签: leaflet openstreetmap electron


【解决方案1】:

看看KothicMapnik,两者都应该能够处理离线osm文件。我猜 Kothic 会更容易实现(纯 JS),因为 Mapnik 本质上是一个带有 node.js 接口的 C++ 库。此外,Kothic 声称与 Leaflet 易于集成,所以我想这应该很适合您。

【讨论】:

    猜你喜欢
    • 2015-02-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多