How to use the wkx.Types function in wkx

To help you get started, we’ve selected a few wkx examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ngageoint / geopackage-js / test / lib / testFeatureCreate.js View on Github external
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) {
github ngageoint / geopackage-js / test / lib / db / testTableCreator.js View on Github external
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();
  });
github ngageoint / geopackage-js / test / lib / testGeoPackageCreate.js View on Github external
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();
  });
github ngageoint / geopackage-js / test / geopackageUtils.js View on Github external
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() {
github ngageoint / geopackage-js / test / geopackageUtils.js View on Github external
.then(function() {
    return GeoPackageUtils.createFeatureTableAndAddFeatures(geopackage, 'point2', [point2], wkx.Types.wkt.Point);
  })
  .then(function() {
github ngageoint / geopackage-js / test / lib / features / user / testFeatureDao.js View on Github external
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,
github ngageoint / geopackage-js / test / lib / features / user / testFeatureDao.js View on Github external
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
              ],
github ngageoint / geopackage-js / test / lib / testFeatureCreate.js View on Github external
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);
      });
github ngageoint / geopackage-js / lib / wkb / index.js View on Github external
/**
 * 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;

wkx

A WKT/WKB/EWKT/EWKB/TWKB/GeoJSON parser and serializer

MIT
Latest version published 5 years ago

Package Health Score

67 / 100
Full package analysis