geopackage-js
geopackage-js copied to clipboard
Unable to execute the sample NodeJS code
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.
`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
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
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);
If you want I can update it ?
Feel free to update and make a pull request. Thank you for your help.
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 https://github.com/ngageoint/geopackage-js/blob/master/test/lib/testFeatureCreate.js#L232-L236
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 [email protected] 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