How to use wkx - 10 common examples

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 tmcw / geojson.net / src / ui / file_bar.js View on Github external
action: function() {
              const input = prompt("Enter your Hex encoded WKB/EWKB");
              try {
                var decoded = wkx.Geometry.parse(Buffer.from(input, "hex"));
                setGeojson(decoded.toGeoJSON());
                // zoomextent(context); TODO
              } catch (e) {
                console.error(e);
                alert(
                  "Sorry, we were unable to decode that Hex encoded WKX data"
                );
              }
            }
          },
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 / lib / wkb / testWkb.js View on Github external
it('should get a geometry collection from a GEOMETRY name', function() {
    var wkb = WKB.fromName('GEOMETRY');
    wkb.should.be.equal(wkx.wkb.GeometryCollection);
  });
github ngageoint / geopackage-js / test / lib / wkb / testWkb.js View on Github external
it('should get a MultiLineString from a wkx.Types.wkt.MultiLineString name', function() {
    var wkb = WKB.fromName(wkx.wkt.MultiLineString);
    wkb.should.be.equal(wkx.wkb.MultiLineString);
  });
github ngageoint / geopackage-js / test / lib / wkb / testWkb.js View on Github external
it('should get a Polygon from a wkx.Types.wkt.Polygon name', function() {
    var wkb = WKB.fromName(wkx.wkt.Polygon);
    wkb.should.be.equal(wkx.wkb.Polygon);
  });
github ngageoint / geopackage-js / test / lib / wkb / testWkb.js View on Github external
it('should get a point from a wkx.Types.wkt.Point name', function() {
    var wkb = WKB.fromName(wkx.wkt.Point);
    wkb.should.be.equal(wkx.wkb.Point);
  });
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() {

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