openlayers-3 in node.js app? -
i'm interested in using ol3 in node.js app (e.g. ol.format apis reading geojson). supported use case?
i ask because doesn't appear work running npm install openlayers
, requiring it. var ol3 = require('openlayers')
fails on code that's looking geolocation
property of window.navigation
object since window.navigation doesn't exist in node.js environment
typeerror: cannot use 'in' operator search 'geolocation' in undefined @ /home/me/src/ol3/node_modules/openlayers/dist/ol.js:144:823 @ openlayers (/home/me/src/ol3/node_modules/openlayers/dist/ol.js:9:22) @ object. (/home/me/src/ol3/node_modules/openlayers/dist/ol.js:13:2) @ module._compile (module.js:460:26) @ object.module._extensions..js (module.js:478:10) @ module.load (module.js:355:32) @ function.module._load (module.js:310:12) @ module.require (module.js:365:17) @ require (module.js:384:17)
you can't use openlayers 3 in purely node context (but it's possible browserify/webpack client side use)
you can stub window
, other objects in node stub tests... it's possible run openlayers 3 phantomjs (headless browser).
i'm not aware openlayers designed other uses browser.
to more insight, should post question on openlayers 3 dev list confirm.
do not duplicate stackoverflow question! you'd better ask "is openlayers3 designed used in browser?" openlayers dev list dev question , not classic library usage/simple assistance nowadays.
Comments
Post a Comment