ngageoint / geopackage-js

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

Unable to execute the sample NodeJS code #98

Open mrkhan opened 7 years ago

mrkhan commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

If you want I can update it ?

danielbarela commented 7 years ago

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

waghmareatul8 commented 6 years ago

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?

danielbarela commented 6 years ago

@waghmareatul8 https://github.com/ngageoint/geopackage-js/blob/master/test/lib/testFeatureCreate.js#L232-L236

waghmareatul8 commented 6 years ago

Dear Sir,

Thanks for your email and reply pointing towards file and section. Im quite new into this, hope come up positively with your constant support.

Kind Regards

On 14 February 2018 at 01:51, Dan notifications@github.com wrote:

@waghmareatul8 https://github.com/waghmareatul8 https://github.com/ngageoint/geopackage-js/blob/master/ test/lib/testFeatureCreate.js#L232-L236

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ngageoint/geopackage-js/issues/98#issuecomment-365391916, or mute the thread https://github.com/notifications/unsubscribe-auth/AavgQjTyGD41fIZKfEHDlRN3sifiFa9Jks5tUe7CgaJpZM4Qsv7A .

--

Thanks with Regards

Atul W