Skip to content

Commit

Permalink
Merge pull request #3 from vojtatom/dev
Browse files Browse the repository at this point in the history
Updated exports, licensing terms and tests
  • Loading branch information
vojtatom committed May 5, 2023
2 parents 7a96156 + 4f69df0 commit 38f747d
Show file tree
Hide file tree
Showing 12 changed files with 69 additions and 28 deletions.
49 changes: 49 additions & 0 deletions LICENCE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
MIT License

Copyright (c) 2023 vojtatom

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

## Third-Party Code

shp.ts uses the following third-party code:

### [ts-shapefile](https://github.com/oyvindi/ts-shapefile/)

> MIT License
>
> Copyright (c) 2020 oyvindi
>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in all
> copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> SOFTWARE.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "shpts",
"private": false,
"version": "1.0.1",
"version": "1.0.2",
"type": "module",
"repository": {
"type": "git",
Expand All @@ -24,7 +24,7 @@
],
"main": "./dist/shpts.umd.js",
"module": "./dist/shpts.js",
"types": "./dist/shpts/shpts.d.ts",
"types": "./dist/shpts.d.ts",
"exports": {
".": {
"import": "./dist/shpts.js",
Expand Down
11 changes: 8 additions & 3 deletions shpts/shpts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,22 @@ import { PointRecord } from './geometry/point';
import { MultiPointRecord } from './geometry/multipoint';
import { MultiPatchRecord } from './geometry/multipatch';
import { DbfRecord } from './table/record';
import { DbfFieldDescr, DbfFieldType } from './types/dbfTypes';
import { Coord, CoordType } from './types/coordinate';

export {
DbfReader,
DbfRecord,
ShapeReader,
FeatureCollection as ShapeFeatureCollection,
Feature as ShapeFeature,
FeatureReader as ShapeFeatureReader,
FeatureCollection,
Feature,
FeatureReader,
PolygonRecord,
PolyLineRecord,
PointRecord,
MultiPointRecord,
MultiPatchRecord,
CoordType,
};

export type { DbfFieldType, DbfFieldDescr, Coord };
3 changes: 1 addition & 2 deletions test/dbf.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { DbfFieldDescr, DbfFieldType } from '@shpts/types/dbfTypes';
import { DbfFieldDescr, DbfFieldType, DbfReader } from '@shpts/shpts';
import { expect, test } from 'vitest';
import { openFileAsArray } from './utils';
import { DbfReader } from '@shpts/reader/dbfReader';

function expectField(
field: DbfFieldDescr,
Expand Down
3 changes: 1 addition & 2 deletions test/features.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { expect, test } from 'vitest';
import { expectPointsEqual, openFileAsArray } from './utils';
import { FeatureReader } from '@shpts/reader/featureReader';
import { PolyLineRecord } from '@shpts/geometry/polyline';
import { FeatureReader, PolyLineRecord } from '@shpts/shpts';

test('Read feature OK', async () => {
const shp = openFileAsArray('testdata/featureclass.shp');
Expand Down
6 changes: 2 additions & 4 deletions test/multipatch.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { expect, test } from 'vitest';
import { ShapeReader } from '@shpts/reader/shpReader';
import { expectGeometry, expectPointsEqual, expectRing, openFileAsArray } from './utils';
import { MultiPatchRecord } from '@shpts/geometry/multipatch';
import { CoordType, Coord } from '@shpts/types/coordinate';
import { expectGeometry, expectRing, openFileAsArray } from './utils';
import { ShapeReader, MultiPatchRecord, CoordType } from '@shpts/shpts';

test('Reading MultiPatchRecord with Z', async () => {
const shpBuffer = openFileAsArray('testdata/multipatch.shp');
Expand Down
4 changes: 1 addition & 3 deletions test/multipoint.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { expect, test } from 'vitest';
import { ShapeReader } from '@shpts/reader/shpReader';
import { expectGeometry, expectPointsEqual, openFileAsArray } from './utils';
import { MultiPointRecord } from '@shpts/geometry/multipoint';
import { CoordType } from '@shpts/types/coordinate';
import { ShapeReader, MultiPointRecord, CoordType } from '@shpts/shpts';

test('Reading PointRecord', async () => {
const shpBuffer = openFileAsArray('testdata/multipoint.shp');
Expand Down
2 changes: 1 addition & 1 deletion test/orientation.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, test } from 'vitest';
import { CoordType, Coord } from '@shpts/types/coordinate';
import { Coord } from '@shpts/types/coordinate';
import { assemblePolygonsWithHoles } from '@shpts/utils/orientation';

test('Testing orientiton for vertical polygons', async () => {
Expand Down
4 changes: 1 addition & 3 deletions test/point.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { test } from 'vitest';
import { ShapeReader } from '@shpts/reader/shpReader';
import { expectGeometry, expectPointsEqual, openFileAsArray } from './utils';
import { PointRecord } from '@shpts/geometry/point';
import { CoordType } from '@shpts/types/coordinate';
import { ShapeReader, PointRecord, CoordType } from '@shpts/shpts';

test('Reading PointRecord', async () => {
const shpBuffer = openFileAsArray('testdata/point.shp');
Expand Down
4 changes: 1 addition & 3 deletions test/polygon.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { expect, test } from 'vitest';
import { ShapeReader } from '@shpts/reader/shpReader';
import { expectGeometry, expectRing, openFileAsArray } from './utils';
import { PolygonRecord } from '@shpts/geometry/polygon';
import { CoordType } from '@shpts/types/coordinate';
import { ShapeReader, PolygonRecord, CoordType } from '@shpts/shpts';

test('Reading PolygonRecord', async () => {
const shpBuffer = openFileAsArray('testdata/polygon.shp');
Expand Down
4 changes: 1 addition & 3 deletions test/polyline.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { expect, test } from 'vitest';
import { ShapeReader } from '@shpts/reader/shpReader';
import { expectGeometry, expectPointsEqual, openFileAsArray } from './utils';
import { PolyLineRecord } from '@shpts/geometry/polyline';
import { CoordType } from '@shpts/types/coordinate';
import { ShapeReader, PolyLineRecord, CoordType } from '@shpts/shpts';

test('Reading PolyLineRecord', async () => {
const shpBuffer = openFileAsArray('testdata/polyline.shp');
Expand Down
3 changes: 1 addition & 2 deletions test/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { ShapeReader } from '@shpts/reader/shpReader';
import { Coord, CoordType } from '@shpts/types/coordinate';
import { ShapeReader, Coord, CoordType } from '@shpts/shpts';
import fs from 'fs';
import { expect } from 'vitest';

Expand Down

0 comments on commit 38f747d

Please sign in to comment.