Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should create a feature table', function() {
var geometryColumns = SetupFeatureTable.buildGeometryColumns(tableName, 'geom.test', wkx.Types.wkt.Point);
var boundingBox = new BoundingBox(-180, 180, -80, 80);
var columns = [];
columns.push(FeatureColumn.createPrimaryKeyColumnWithIndexAndName(0, 'id'));
columns.push(FeatureColumn.createColumnWithIndexAndMax(7, 'test_text_limited.test', DataTypes.GPKGDataType.GPKG_DT_TEXT, 5, false, null));
columns.push(FeatureColumn.createColumnWithIndexAndMax(8, 'test_blob_limited.test', DataTypes.GPKGDataType.GPKG_DT_BLOB, 7, false, null));
columns.push(FeatureColumn.createGeometryColumn(1, 'geom.test', wkx.Types.wkt.Point, false, null));
columns.push(FeatureColumn.createColumnWithIndex(2, 'test_text.test', DataTypes.GPKGDataType.GPKG_DT_TEXT, false, ""));
columns.push(FeatureColumn.createColumnWithIndex(3, 'test_real.test', DataTypes.GPKGDataType.GPKG_DT_REAL, false, null));
columns.push(FeatureColumn.createColumnWithIndex(4, 'test_boolean.test', DataTypes.GPKGDataType.GPKG_DT_BOOLEAN, false, null));
columns.push(FeatureColumn.createColumnWithIndex(5, 'test_blob.test', DataTypes.GPKGDataType.GPKG_DT_BLOB, false, null));
columns.push(FeatureColumn.createColumnWithIndex(6, 'test_integer.test', DataTypes.GPKGDataType.GPKG_DT_INTEGER, false, ""));
geopackage.createFeatureTableWithGeometryColumns(geometryColumns, boundingBox, 4326, columns)
.then(function(result) {
it('should create a user feature table', function(done) {
var featureTable = SetupFeatureTable.buildFeatureTable('test_features', 'geom', wkx.Types.wkt.Point);
var tc = new TableCreator(geopackage);
var result = tc.createUserTable(featureTable);
Verification.verifyTableExists(geopackage, 'test_features').should.be.equal(true);
done();
});
it('should create a user feature table', function(done) {
var featureTable = SetupFeatureTable.buildFeatureTable('test_features', 'geom', wkx.Types.wkt.Point);
var result = geopackage.createFeatureTable(featureTable);
Verification.verifyTableExists(geopackage, 'test_features').should.be.equal(true);
done();
});
name: 'East Lockheed Drive'
};
var line2 = {
geoJson: ngaLine,
name: 'NGA'
};
var poly1 = {
geoJson: bitsPolygon,
name: 'BIT Systems'
};
var poly2 = {
geoJson: ngaVisitorCenterPolygon,
name: 'NGA Visitor Center'
};
return GeoPackageUtils.createFeatureTableAndAddFeatures(geopackage, 'point1', [point1], wkx.Types.wkt.Point)
.then(function() {
return GeoPackageUtils.createFeatureTableAndAddFeatures(geopackage, 'point2', [point2], wkx.Types.wkt.Point);
})
.then(function() {
return GeoPackageUtils.createFeatureTableAndAddFeatures(geopackage, 'line1', [line1], wkx.Types.wkt.LineString);
})
.then(function() {
return GeoPackageUtils.createFeatureTableAndAddFeatures(geopackage, 'line2', [line2], wkx.Types.wkt.LineString);
})
.then(function() {
return GeoPackageUtils.createFeatureTableAndAddFeatures(geopackage, 'polygon1', [poly1], wkx.Types.wkt.Polygon);
})
.then(function() {
return GeoPackageUtils.createFeatureTableAndAddFeatures(geopackage, 'polygon2', [poly2], wkx.Types.wkt.Polygon);
})
.then(function() {
.then(function() {
return GeoPackageUtils.createFeatureTableAndAddFeatures(geopackage, 'point2', [point2], wkx.Types.wkt.Point);
})
.then(function() {
testSetup.createGeoPackage(testGeoPackage, function(err, gp) {
geopackage = gp;
var geometryColumns = SetupFeatureTable.buildGeometryColumns('QueryTest', 'geom', wkx.Types.wkt.GeometryCollection);
var boundingBox = new BoundingBox(-180, 180, -80, 80);
var columns = [];
columns.push(FeatureColumn.createPrimaryKeyColumnWithIndexAndName(0, 'id'));
columns.push(FeatureColumn.createGeometryColumn(1, 'geom', wkx.Types.wkt.Point, false, null));
columns.push(FeatureColumn.createColumnWithIndex(2, 'name', DataTypes.GPKGDataType.GPKG_DT_TEXT, false, ""));
columns.push(FeatureColumn.createColumnWithIndex(3, '_feature_id', DataTypes.GPKGDataType.GPKG_DT_TEXT, false, ""));
columns.push(FeatureColumn.createColumnWithIndex(4, '_properties_id', DataTypes.GPKGDataType.GPKG_DT_TEXT, false, ""));
var box1 = {
"type": "Polygon",
"coordinates": [
[
[
-1,
testSetup.createGeoPackage(testGeoPackage, function(err, gp) {
geopackage = gp;
var geometryColumns = SetupFeatureTable.buildGeometryColumns('QueryTest', 'geom', wkx.Types.wkt.GeometryCollection);
var boundingBox = new BoundingBox(-180, 180, -80, 80);
var columns = [];
columns.push(FeatureColumn.createPrimaryKeyColumnWithIndexAndName(0, 'id'));
columns.push(FeatureColumn.createGeometryColumn(1, 'geom', wkx.Types.wkt.Point, false, null));
columns.push(FeatureColumn.createColumnWithIndex(2, 'name', DataTypes.GPKGDataType.GPKG_DT_TEXT, false, ""));
columns.push(FeatureColumn.createColumnWithIndex(3, '_feature_id', DataTypes.GPKGDataType.GPKG_DT_TEXT, false, ""));
columns.push(FeatureColumn.createColumnWithIndex(4, '_properties_id', DataTypes.GPKGDataType.GPKG_DT_TEXT, false, ""));
var box1 = {
"type": "Polygon",
"coordinates": [
[
[
-1,
1
],
[
1,
1
],
beforeEach(function() {
var geometryColumns = SetupFeatureTable.buildGeometryColumns(tableName, 'geom', wkx.Types.wkt.Point);
var boundingBox = new BoundingBox(-180, 180, -80, 80);
var columns = [];
columns.push(FeatureColumn.createPrimaryKeyColumnWithIndexAndName(0, 'id'));
columns.push(FeatureColumn.createColumnWithIndexAndMax(7, 'test_text_limited', DataTypes.GPKGDataType.GPKG_DT_TEXT, 5, false, null));
columns.push(FeatureColumn.createColumnWithIndexAndMax(8, 'test_blob_limited', DataTypes.GPKGDataType.GPKG_DT_BLOB, 7, false, null));
columns.push(FeatureColumn.createGeometryColumn(1, 'geom', wkx.Types.wkt.Point, false, null));
columns.push(FeatureColumn.createColumnWithIndex(2, 'test_text.test', DataTypes.GPKGDataType.GPKG_DT_TEXT, false, ""));
columns.push(FeatureColumn.createColumnWithIndex(3, 'test_real', DataTypes.GPKGDataType.GPKG_DT_REAL, false, null));
columns.push(FeatureColumn.createColumnWithIndex(4, 'test_boolean', DataTypes.GPKGDataType.GPKG_DT_BOOLEAN, false, null));
columns.push(FeatureColumn.createColumnWithIndex(5, 'test_blob', DataTypes.GPKGDataType.GPKG_DT_BLOB, false, null));
columns.push(FeatureColumn.createColumnWithIndex(6, 'test_integer', DataTypes.GPKGDataType.GPKG_DT_INTEGER, false, ""));
columns.push(FeatureColumn.createColumnWithIndex(9, 'test space', DataTypes.GPKGDataType.GPKG_DT_TEXT, false, ""));
columns.push(FeatureColumn.createColumnWithIndex(10, 'test-dash', DataTypes.GPKGDataType.GPKG_DT_TEXT, false, ""));
return geopackage.createFeatureTableWithGeometryColumns(geometryColumns, boundingBox, 4326, columns)
.then(function(result) {
var verified = Verification.verifyGeometryColumns(geopackage)
&& Verification.verifyTableExists(geopackage, tableName)
&& Verification.verifyContentsForTable(geopackage, tableName)
&& Verification.verifyGeometryColumnsForTable(geopackage, tableName);
verified.should.be.equal(true);
});
/**
* WKB module.
* @module wkb
*/
var wkx = require('wkx');
var wktToEnum = {};
wktToEnum[wkx.Types.wkt.Point] = wkx.Types.wkb.Point;
wktToEnum[wkx.Types.wkt.LineString] = wkx.Types.wkb.LineString;
wktToEnum[wkx.Types.wkt.Polygon] = wkx.Types.wkb.Polygon;
wktToEnum[wkx.Types.wkt.MultiPoint] = wkx.Types.wkb.MultiPoint;
wktToEnum[wkx.Types.wkt.MultiLineString] = wkx.Types.wkb.MultiLineString;
wktToEnum[wkx.Types.wkt.MultiPolygon] = wkx.Types.wkb.MultiPolygon;
wktToEnum[wkx.Types.wkt.GeometryCollection] = wkx.Types.wkb.GeometryCollection;
/**
* number from name
* @param {string} name name
* @return {Number} number corresponding to the wkb name
*/
module.exports.fromName = function(name) {
name = name.toUpperCase();
if (name === 'GEOMETRY') {
return wkx.Types.wkb.GeometryCollection;