0
votes

I'm creating an app with Electron (the GitHub instrument to create apps with html and node.js). This app will be used by some computer that they aren't connected to internet. I need to show a map and collocate markers on it (I found Leaflet), but all maps service require internet. With Open Street Maps I can export an osm file but I can't find a way to render it into Leaflet, because the only library for node (mapbox-gl-native-master) who do it require C++11 and it gives me error in installation:

$ npm install mapbox-gl-native

> [email protected] 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! [email protected] preinstall: `npm install node-pre-gyp`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] 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
1
Writing a map application using web technologies that works offline isn't trivial. You might want to ask at gis.stackexchange.com - Steve Bennett

1 Answers

0
votes

Take a look at either Kothic or Mapnik, Both should be more than capable of handling offline osm files. I guess Kothic will be a tad easier to implement (pure JS), since Mapnik essentially is a C++ library with a node.js interface. Additionally, Kothic claims easy integration with Leaflet, so I imagine this should suit you quite well.