connormanning / ept-tools

Entwine Point Tile point cloud utilities
https://entwine.io
MIT License
53 stars 27 forks source link

Can't get ept serve to serve on windows 10 without "path must end with ept.json" error. #23

Closed tfiner closed 4 months ago

tfiner commented 3 years ago

Reproduction:

  1. Install ept tools per the instructions (which means installing node js, then logging out and in on windows to get it in the path): npm install ept-tools -g I had to use --force because a previous install did not uninstall properly and left index.js behind and install would not overwrite it.
  2. Start ept serve: ept serve
  3. Enter a URL into a browser: http://localhost:3000/tileset.json?ept=http://somevalidurl/ept.json

Observations The return is always the json message: {"message": "Invalid EPT path must end with \"/ept.json\""} The console running shows an error 400 and the url above I was able to get correct results by installing ept tools into WSL. Everything else is the same (the underlying file server, the urls, the files, etc.), so I suspect that the code is platform specific and doesn't work well in windows.

Expectations

BTW, thanks again for writing these tools, I really like that the tool serves 3d tiles on the fly.

tfiner commented 3 years ago

More information: I was able to inspect debug using chrome and I see that ept: const ept = protopath_1.normalize(options.ept); if (!ept.endsWith('/ept.json')) { throw new types_1.HttpError(400, 'Invalid EPT path - must end with "/ept.json"'); } is set to: http://192.168.86.135\entwine\rh_cactf\ept.json

even though the original request all has forward slashes (as expected).

tfiner commented 3 years ago

OK, I can see what's going on here, it looks like ept tools is using filesystem function in path.js called normalize. This doesn't seem like the right thing to do with a URL? Why is there a need to "normalize" a URL using a module made to work on filesystem paths? This just happens to work on systems that share the forward slash as a delimiter.

I commented out the two calls to normalize (and directly copy the ept value to and from options) and I'm able to see the returned ept.json and 3d tiles! I don't know enough about node.js to do a pull request or I'd do so.

gali09 commented 4 months ago

Hello, I'm trying to set up a server using: ept serve --roots http://na.entwine.io Everything seems to be working fine, but then when I try to access one of the ept.json files via a URL of the type 'http://localhost:3000/tileset.json?ept=http://na.entwine.io/A7_pk799a811/ept.json' I always get the error: {"message":"Invalid EPT path - must end with \"/ept.json\""} @tfiner How were you able to fix this error?

PS: @connormanning Thank you very much for this tool.

tfiner commented 4 months ago

For my case, running on Windows, I had to comment out some calls that change a URL path into an OS filesystem path. If you are running on windows, you might have to do the same (from my comment a few years ago, the name of the function to try commenting out is "normalize").

connormanning commented 4 months ago

This project is not maintained anymore, in favor of viewer.copc.io, which will translate your dataset from EPT/COPC to 3D Tiles in the browser so you are not required to translate them to 3D Tiles on disk or use an EPT Tools server - just point at your data over HTTP (or drag/drop a COPC file). See for example COPC and EPT (the Cesium links here) sample data.

I will update the readme for this project.