ngageoint / geopackage-js

GeoPackage JavaScript Library
http://ngageoint.github.io/geopackage-js/
MIT License
304 stars 78 forks source link

Unable to get a very basic browser-based demo working #164

Closed richard-thomas closed 3 years ago

richard-thomas commented 4 years ago

I've been trying to get a very basic demo of reading a gpkg in the browser going for several days now on a Windows 10 machine. Although I want to proceed to incorporating it within Webpack (but not using anything like React, which I am not familiar with and don't need), I am initially trying to get something simple running in an unpackaged format so I can quickly develop/debug. Grateful if you could suggest a complete bit of code (including the appropriate HTML script lines) as I am starting to tear my hair out; I think I am missing some quite basic things!

My attempts so far:

danielbarela commented 4 years ago

I am not sure if you are missing things, necessarily. Building this library for use in a web app like the demo page is not currently a very good way to try things out. When we build to deploy the demo page to github pages we use the following command from the root of the repository: npm run gh-pages-build This will build the demo page into the docs directory so that it can be ran. The biggest problem with this is that it requires rebuilding the entire library manually each time you make a change which is far from ideal.

We do have someone working on updating the demo page to be easier to build, and function more like a real web-app instead of simple an example page I put together quickly.

More on npm run gh-pages-build: All this really does is run npm install from the docs directory which ends up running a browserify command browserify index.js --standalone gp --exclude better-sqlite3 --exclude inquirer --exclude canvas --exclude node-expat -t [ babelify --presets [@babel/preset-env] ] -o gp.js The gp.js file is the fully build library which is then included in the index.html file in the docs directory. Once again, we are putting a resource towards improving this altogether and making it easier for folks to build iteratively but if you have any improvements to contribute we would absolutely welcome them.

danielbarela commented 4 years ago

This is an incredible example of a minimal Angular page using this library. https://github.com/jesperthomsen/geopackagebuffer