plepe / OpenStreetBrowser

An application to ‘browse’ the information in the displayed part of the map. Similar to common Wikis and also the main page of http://www.openstreetmap.org the website shows a narrow menu on the left side, most of the page is used for the display of the map. In contrast to most Wikis the menu is not static, but rather the content of the map can be browsed in categories. For the map a special style has been developed (sorry guys, I neither like the default Mapnik nor Osmarender styles), and special overlays are displayed to support the current browsed categories. When you click on an object (either from the list or directly on the map) informations on this object are displayed.
http://www.openstreetbrowser.org
GNU General Public License v3.0
88 stars 20 forks source link

Confusion about Installation #157

Closed xeruf closed 2 years ago

xeruf commented 2 years ago

First of all, thank you for this project, I am currently investigating whether I can improve it for what I want to build rather than building something new ;)

For that I first of all need to set it up, and found the readme instructions diverting from the install file in confusing ways - php-yaml is mentioned in the readme but not in the install, which mentions a host of other packages?

Furthermore, are there successful installations on later servers? I'd rather use Debian 11 than the wildly dated Ubuntu 16 ;) which PHP versions are verified to work?

by the by, where are the nice marker icons from?

xeruf commented 2 years ago

npm install fails :/

> openstreetbrowser@5.2.0 build-locales
> for i in `ls locales/` ; do browserify locales/$i -o dist/locale-$i ; done

(node:19632) UnhandledPromiseRejectionWarning: Error: Cannot find module 'fs/promises'
Require stack:
- /var/www/html/openstreetbrowser/node_modules/minify/lib/minify.js
- /var/www/html/openstreetbrowser/node_modules/minify/bin/minify.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
    at Function.Module._load (internal/modules/cjs/loader.js:667:27)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/var/www/html/openstreetbrowser/node_modules/minify/lib/minify.js:5:20)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
(node:19632) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:19632) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

added 905 packages, and audited 906 packages in 1m

7 vulnerabilities (2 low, 4 moderate, 1 critical)

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.

$ npm audit
# npm audit report

minimist  <=1.2.5
Severity: critical
Prototype Pollution in minimist - https://github.com/advisories/GHSA-xvch-5gv4-984h
Prototype Pollution in minimist - https://github.com/advisories/GHSA-vh95-rmgr-6w4m
Prototype Pollution in minimist - https://github.com/advisories/GHSA-vh95-rmgr-6w4m
fix available via `npm audit fix --force`
Will install overpass-layer@2.0.0, which is a breaking change
node_modules/@mapbox/geojson-rewind/node_modules/minimist
node_modules/sharkdown/node_modules/minimist
  @mapbox/geojson-rewind  <=0.4.1
  Depends on vulnerable versions of minimist
  Depends on vulnerable versions of sharkdown
  node_modules/@mapbox/geojson-rewind
    osmtogeojson  >=1.1.0
    Depends on vulnerable versions of @mapbox/geojson-rewind
    Depends on vulnerable versions of xmldom
    node_modules/osmtogeojson
      overpass-frontend  >=0.2.1
      Depends on vulnerable versions of osmtogeojson
      node_modules/overpass-frontend
        overpass-layer  >=2.1.0
        Depends on vulnerable versions of overpass-frontend
        node_modules/overpass-layer
  sharkdown  *
  Depends on vulnerable versions of minimist
  node_modules/sharkdown

xmldom  *
Severity: moderate
Misinterpretation of malicious XML input - https://github.com/advisories/GHSA-5fg8-2547-mr8q
Misinterpretation of malicious XML input - https://github.com/advisories/GHSA-h6q6-9hqw-rwfv
fix available via `npm audit fix --force`
Will install overpass-layer@2.0.0, which is a breaking change
node_modules/xmldom
  osmtogeojson  >=1.1.0
  Depends on vulnerable versions of @mapbox/geojson-rewind
  Depends on vulnerable versions of xmldom
  node_modules/osmtogeojson
    overpass-frontend  >=0.2.1
    Depends on vulnerable versions of osmtogeojson
    node_modules/overpass-frontend
      overpass-layer  >=2.1.0
      Depends on vulnerable versions of overpass-frontend
      node_modules/overpass-layer

7 vulnerabilities (2 low, 4 moderate, 1 critical)

To address all issues (including breaking changes), run:
  npm audit fix --force

$ node -v
v12.22.12
xeruf commented 2 years ago

Is this supposed to work locally? I need this to work today, otherwise I'll have to look at other tools and can't add my contributions here :/

bin/download_dependencies: 3: cannot create data/tag2link-wikidata.json: Directory nonexistent
bin/download_dependencies: 4: cannot create data/tag2link-sophox.json: Directory nonexistent
PHP Warning:  file_get_contents(data/tag2link-wikidata.json): failed to open stream: No such file or directory in /var/www/html/openstreetbrowser/bin/tag2link-converter on line 7
PHP Notice:  Trying to access array offset on value of type null in /var/www/html/openstreetbrowser/bin/tag2link-converter on line 9
PHP Notice:  Trying to access array offset on value of type null in /var/www/html/openstreetbrowser/bin/tag2link-converter on line 9
PHP Warning:  Invalid argument supplied for foreach() in /var/www/html/openstreetbrowser/bin/tag2link-converter on line 9
PHP Warning:  file_get_contents(data/tag2link-sophox.json): failed to open stream: No such file or directory in /var/www/html/openstreetbrowser/bin/tag2link-converter on line 7
PHP Notice:  Trying to access array offset on value of type null in /var/www/html/openstreetbrowser/bin/tag2link-converter on line 9
PHP Notice:  Trying to access array offset on value of type null in /var/www/html/openstreetbrowser/bin/tag2link-converter on line 9
PHP Warning:  Invalid argument supplied for foreach() in /var/www/html/openstreetbrowser/bin/tag2link-converter on line 9
plepe commented 2 years ago

Sorry, I will look into this later - OpenStreetBrowser is only my pet project.

You have to create the 'data' directory for download_dependencies to work.

plepe commented 2 years ago

Maybe you should check-out https://github.com/plepe/overpass-layer . This is the JS render part of OpenStreetBrowser, this could be sufficient for your project.

plepe commented 2 years ago

About the "fs/promises" problem. This appears in the 'minify' process. You can still use OpenStreetBrowser, you just have to replace "dist/openstreetbrowser.min.js" by "dist/openstreetbrowser.js" in index.php, line 57.

plepe commented 2 years ago

I updated the installation instructions for Ubuntu 22.04.

Please note, that I also commented out a configuration option in conf.php: 191cbe1d740e8386062bfb5fd79459d6c9ee47a5

plepe commented 2 years ago

Okay, I solved the minify-problem too. If you install a modern nodejs from nodejs.org resp. nodesource, minifying works.

On the other hand, using the dist/openstreetbrowser.js file helps when debugging. Also, when using npm run watch, you have use dist/openstreetbrowser.js in index.php.

xeruf commented 2 years ago
image

kind of have it now, no errors in network and console, but page is empty :/

plepe commented 2 years ago

Did you change the file index.php to include dist/openstreetbrowser.js instead of dist/openstreetbrowser.min.js?

xeruf commented 2 years ago

Ah, thank you so much, I missed that! It works now, yeah!

But after all, I might really rather integrate https://github.com/plepe/overpass-layer, let's see... The demo there is served from the index.html in the repo, right? But that does not use https://github.com/plepe/openstreetbrowser-categories-main? Because I really like all the icon details :)

xeruf commented 2 years ago

little remaining issue, maybe because I am on debian:

> modulekit/build_cache
sh: 1: setfacl: not found
sh: 1: setfacl: not found

or is there a package missing in the installation instructions?

EDIT: ah, a todo comment is there ;)

xeruf commented 2 years ago

if you are open for a quick call tomorrow I could also give you a bit of insight on why I want to use your work ;)

xeruf commented 2 years ago

Basically I want something more simple and smooth like https://leaflet-overpass-layer-demo.stackblitz.io but with categories and icons like in osb ;)

plepe commented 2 years ago

No, the categories can not be directly used in overpass-layer, there's a little bit of magic happening in inc/CategoryOverpass.js; also - in the JSON files - most arrays will be merged to multi-line strings (a reason, why I switched to YAML now).

For the icons: I'm using the sets described in https://github.com/plepe/OpenStreetBrowser/blob/master/doc/Icons.md

For the setfacl bug -> install the 'acl' package.