Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to execute the sample NodeJS code #98

Open
mrkhan opened this issue Nov 28, 2017 · 7 comments
Open

Unable to execute the sample NodeJS code #98

mrkhan opened this issue Nov 28, 2017 · 7 comments

Comments

@mrkhan
Copy link
Contributor

mrkhan commented Nov 28, 2017

Hi,

I was trying to use the NodeJS Usage code mentioned in README.md but got an error

TypeError: Cannot read property 'open' of undefined
at Object. (\app.js:10:18)

`var geopackage = require('@ngageoint/geopackage')
, GeoPackageManager = geopackage.GeoPackageManager
, GeoPackageConnection = geopackage.GeoPackageConnection
, GeoPackageTileRetriever = geopackage.GeoPackageTileRetriever;

var filename = "./rivers.gpkg";

GeoPackageManager.open(filename, function(err, geoPackage) {`

it seems that GeoPackageManager is undefined.
is there any prerequisite before using geopackage-js ?

Regards,
M. Rizwan Khan

@mrkhan
Copy link
Contributor Author

mrkhan commented Nov 28, 2017

Just an observation in index.js file
in start of the file, its exporting other modules except the GeoPackageManager module

var proj4Defs = require('./lib/proj4Defs'); module.exports.proj4Defs = proj4Defs; module.exports.GeoPackageTileRetriever = GeoPackageTileRetriever; module.exports.GeoPackageConnection = GeoPackageConnection;

If I add module.exports.GeoPackageManager = GeoPackageManager; to it the sample code works fine.
So is the readme file incorrect or the code?

Regards,
M. Rizwan Khan

@danielbarela
Copy link
Member

The README has not been updated to the new version of the code. I will update it to be correct. When you require var geopackage = require('@ngageoint/geopackage') you can now open a GeoPackage by calling geopackage.open(filename, callback);

@mrkhan
Copy link
Contributor Author

mrkhan commented Nov 29, 2017

If you want I can update it ?

@danielbarela
Copy link
Member

Feel free to update and make a pull request. Thank you for your help.

@waghmareatul8
Copy link

How can we retrieve the content of geom, in other words how can we retrieve coordinates (long,lat) of a point using JavaScript from Geo-package?

@waghmareatul8
Copy link

waghmareatul8 commented Feb 13, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants