update proj4; ignore projection if it throws error
This commit is contained in:
parent
24e9d0877d
commit
2ef8bd37ce
1
.gitignore
vendored
1
.gitignore
vendored
@ -30,3 +30,4 @@ libs/CesiumUnminified
|
|||||||
/pointclouds/sjl2
|
/pointclouds/sjl2
|
||||||
/pointclouds/morro_bay_converted
|
/pointclouds/morro_bay_converted
|
||||||
/pointclouds/helimap_epalinges
|
/pointclouds/helimap_epalinges
|
||||||
|
pointclouds/F
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
##Proj4js -- Javascript reprojection library.
|
## Proj4js -- Javascript reprojection library.
|
||||||
|
|
||||||
Authors:
|
Authors:
|
||||||
- Mike Adair madairATdmsolutions.ca
|
- Mike Adair madairATdmsolutions.ca
|
||||||
@ -26,4 +26,4 @@ Copyright (c) 2014, Mike Adair, Richard Greenwood, Didier Richard, Stephen Irons
|
|||||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
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
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
DEALINGS IN THE SOFTWARE._
|
DEALINGS IN THE SOFTWARE._
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
# PROJ4JS [](https://travis-ci.org/proj4js/proj4js)
|
# PROJ4JS [](https://travis-ci.org/proj4js/proj4js)
|
||||||
|
|
||||||
Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations.
|
Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations.
|
||||||
Originally a port of [PROJ.4](http://trac.osgeo.org/proj/) and [GCTCP C](http://edcftp.cr.usgs.gov/pub//software/gctpc) it is
|
Originally a port of [PROJ](https://proj.org/) ([then known as PROJ.4](https://proj.org/faq.html#what-happened-to-proj-4)) and GCTCP C ([Archive](https://web.archive.org/web/20130523091752/http://edcftp.cr.usgs.gov/pub/software/gctpc/)) it is
|
||||||
a part of the [MetaCRS](http://wiki.osgeo.org/wiki/MetaCRS) group of projects.
|
a part of the [MetaCRS](https://trac.osgeo.org/metacrs/wiki) group of projects.
|
||||||
|
|
||||||
## Installing
|
## Installing
|
||||||
|
|
||||||
@ -11,17 +11,16 @@ Depending on your preferences
|
|||||||
```bash
|
```bash
|
||||||
npm install proj4
|
npm install proj4
|
||||||
bower install proj4
|
bower install proj4
|
||||||
jam install proj4
|
|
||||||
component install proj4js/proj4js
|
component install proj4js/proj4js
|
||||||
```
|
```
|
||||||
|
|
||||||
or just manually grab the file `proj4.js` from the [latest release](https://github.com/proj4js/proj4js/releases).
|
or just manually grab the file `proj4.js` from the [latest release](https://github.com/proj4js/proj4js/releases)'s `dist/` folder.
|
||||||
|
|
||||||
if you do not want to download anything, Proj4js is also hosted on [cdnjs](http://www.cdnjs.com/libraries/proj4js) for direct use in your browser applications.
|
If you do not want to download anything, Proj4js is also hosted on [cdnjs](https://www.cdnjs.com/libraries/proj4js) for direct use in your browser applications.
|
||||||
|
|
||||||
## Using
|
## Using
|
||||||
|
|
||||||
the basic signature is:
|
The basic signature is:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
proj4(fromProjection[, toProjection, coordinates])
|
proj4(fromProjection[, toProjection, coordinates])
|
||||||
@ -57,7 +56,7 @@ proj4(secondProjection,firstProjection).inverse([2,5]);
|
|||||||
// [-2690666.2977344505, 3662659.885459918]
|
// [-2690666.2977344505, 3662659.885459918]
|
||||||
```
|
```
|
||||||
|
|
||||||
and as above if only one projection is given, it's assumed to be coming from wgs84
|
And as above if only one projection is given, it's assumed to be coming from wgs84:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
proj4(firstProjection).forward([-71,41]);
|
proj4(firstProjection).forward([-71,41]);
|
||||||
@ -89,7 +88,7 @@ proj4.defs([
|
|||||||
]);
|
]);
|
||||||
```
|
```
|
||||||
|
|
||||||
you can then do
|
you can then do
|
||||||
|
|
||||||
```js
|
```js
|
||||||
proj4('EPSG:4326');
|
proj4('EPSG:4326');
|
||||||
@ -106,48 +105,56 @@ instead of writing out the whole proj definition, by default proj4 has the follo
|
|||||||
- 'EPSG:900913'
|
- 'EPSG:900913'
|
||||||
- 'EPSG:102113'
|
- 'EPSG:102113'
|
||||||
|
|
||||||
defined projections can also be accessed through the proj4.defs function (`proj4.defs('EPSG:4326')`).
|
Defined projections can also be accessed through the proj4.defs function (`proj4.defs('EPSG:4326')`).
|
||||||
|
|
||||||
proj4.defs can also be used to define a named alias:
|
proj4.defs can also be used to define a named alias:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
proj4.defs('urn:x-ogc:def:crs:EPSG:4326', proj4.defs('EPSG:4326'));
|
proj4.defs('urn:x-ogc:def:crs:EPSG:4326', proj4.defs('EPSG:4326'));
|
||||||
```
|
|
||||||
|
|
||||||
## Developing
|
|
||||||
to set up build tools make sure you have node and grunt-cli installed and then run `npm install`
|
|
||||||
|
|
||||||
to do the complete build and browser tests run
|
|
||||||
|
|
||||||
```bash
|
|
||||||
grunt
|
|
||||||
```
|
```
|
||||||
|
|
||||||
to run node tests run
|
## TypeScript
|
||||||
|
|
||||||
|
TypeScript implementation was added to the [DefinitelyTyped repository](https://github.com/DefinitelyTyped/DefinitelyTyped).
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ npm install --save @types/proj4
|
||||||
|
```
|
||||||
|
|
||||||
|
## Developing
|
||||||
|
To set up build tools make sure you have node and grunt-cli installed and then run `npm install`.
|
||||||
|
|
||||||
|
To do the complete build and browser tests run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
node_modules/.bin/grunt
|
||||||
|
```
|
||||||
|
|
||||||
|
To run node tests run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm test
|
npm test
|
||||||
```
|
```
|
||||||
|
|
||||||
to run node tests with coverage run
|
To run node tests with coverage run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
node test --coverage
|
npm test --coverage
|
||||||
```
|
```
|
||||||
|
|
||||||
to create a build with only default projections (latlon and Mercator) run
|
To create a build with only default projections (latlon and Mercator) run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
grunt build
|
node_modules/.bin/grunt build
|
||||||
```
|
```
|
||||||
|
|
||||||
to create a build with only custom projections include a comma separated list of projections codes (the file name in 'lib/projections' without the '.js') after a colon, e.g.
|
To create a build with only custom projections include a comma separated list of projections codes (the file name in 'lib/projections' without the '.js') after a colon, e.g.:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
grunt build:tmerc
|
node_modules/.bin/grunt build:tmerc
|
||||||
#includes transverse Mercator
|
#includes transverse Mercator
|
||||||
grunt build:lcc
|
node_modules/.bin/grunt build:lcc
|
||||||
#includes lambert conformal conic
|
#includes lambert conformal conic
|
||||||
grunt build:omerc,moll
|
node_modules/.bin/grunt build:omerc,moll
|
||||||
#includes oblique Mercator and Mollweide
|
#includes oblique Mercator and Mollweide
|
||||||
```
|
```
|
||||||
|
|||||||
6135
libs/proj4/proj4-src.js
Normal file
6135
libs/proj4/proj4-src.js
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
2
libs/proj4/test.html
Normal file
2
libs/proj4/test.html
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.4.3/proj4.js"></script>
|
||||||
|
|
||||||
@ -63,6 +63,20 @@ export class PointCloudEptGeometry {
|
|||||||
else this.fallbackProjection = info.srs.wkt;
|
else this.fallbackProjection = info.srs.wkt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// TODO [mschuetz]: named projections that proj4 can't handle seem to cause problems.
|
||||||
|
// remove them for now
|
||||||
|
|
||||||
|
try{
|
||||||
|
proj4(this.projection);
|
||||||
|
}catch(e){
|
||||||
|
this.projection = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
const attributes = new PointAttributes();
|
const attributes = new PointAttributes();
|
||||||
|
|||||||
@ -145,6 +145,9 @@ export class PointCloudOctreeGeometryNode extends PointCloudTreeNode{
|
|||||||
|
|
||||||
// load hierarchy
|
// load hierarchy
|
||||||
let callback = function (node, hbuffer) {
|
let callback = function (node, hbuffer) {
|
||||||
|
|
||||||
|
let tStart = performance.now();
|
||||||
|
|
||||||
let view = new DataView(hbuffer);
|
let view = new DataView(hbuffer);
|
||||||
|
|
||||||
let stack = [];
|
let stack = [];
|
||||||
@ -205,6 +208,12 @@ export class PointCloudOctreeGeometryNode extends PointCloudTreeNode{
|
|||||||
nodes[name] = currentNode;
|
nodes[name] = currentNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let duration = performance.now() - tStart;
|
||||||
|
if(duration > 5){
|
||||||
|
let msg = `duration: ${duration}ms, numNodes: ${decoded.length}`;
|
||||||
|
console.log(msg);
|
||||||
|
}
|
||||||
|
|
||||||
node.loadPoints();
|
node.loadPoints();
|
||||||
};
|
};
|
||||||
if ((node.level % node.pcoGeometry.hierarchyStepSize) === 0) {
|
if ((node.level % node.pcoGeometry.hierarchyStepSize) === 0) {
|
||||||
|
|||||||
@ -125,29 +125,19 @@ export class NodeLoader{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async loadHierarchy(node){
|
parseHierarchy(node, buffer){
|
||||||
|
|
||||||
let {hierarchyByteOffset, hierarchyByteSize} = node;
|
|
||||||
let hierarchyPath = `${this.url}/../hierarchy.bin`;
|
|
||||||
|
|
||||||
let first = hierarchyByteOffset;
|
|
||||||
let last = first + hierarchyByteSize - 1n;
|
|
||||||
|
|
||||||
let response = await fetch(hierarchyPath, {
|
|
||||||
headers: {
|
|
||||||
'content-type': 'multipart/byteranges',
|
|
||||||
'Range': `bytes=${first}-${last}`,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
let buffer = await response.arrayBuffer();
|
|
||||||
let view = new DataView(buffer);
|
let view = new DataView(buffer);
|
||||||
|
let tStart = performance.now();
|
||||||
|
|
||||||
let bytesPerNode = 22;
|
let bytesPerNode = 22;
|
||||||
let numNodes = buffer.byteLength / bytesPerNode;
|
let numNodes = buffer.byteLength / bytesPerNode;
|
||||||
|
|
||||||
let octree = node.octreeGeometry;
|
let octree = node.octreeGeometry;
|
||||||
let nodes = [node];
|
// let nodes = [node];
|
||||||
|
let nodes = new Array(numNodes);
|
||||||
|
nodes[0] = node;
|
||||||
|
let nodePos = 1;
|
||||||
|
|
||||||
for(let i = 0; i < numNodes; i++){
|
for(let i = 0; i < numNodes; i++){
|
||||||
let current = nodes[i];
|
let current = nodes[i];
|
||||||
@ -196,17 +186,50 @@ export class NodeLoader{
|
|||||||
current.children[childIndex] = child;
|
current.children[childIndex] = child;
|
||||||
child.parent = current;
|
child.parent = current;
|
||||||
|
|
||||||
nodes.push(child);
|
// nodes.push(child);
|
||||||
|
nodes[nodePos] = child;
|
||||||
|
nodePos++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let duration = (performance.now() - tStart);
|
||||||
|
|
||||||
|
if(duration > 20){
|
||||||
|
let msg = `duration: ${duration}ms, numNodes: ${numNodes}`;
|
||||||
|
console.log(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async loadHierarchy(node){
|
||||||
|
|
||||||
|
let {hierarchyByteOffset, hierarchyByteSize} = node;
|
||||||
|
let hierarchyPath = `${this.url}/../hierarchy.bin`;
|
||||||
|
|
||||||
|
let first = hierarchyByteOffset;
|
||||||
|
let last = first + hierarchyByteSize - 1n;
|
||||||
|
|
||||||
|
let response = await fetch(hierarchyPath, {
|
||||||
|
headers: {
|
||||||
|
'content-type': 'multipart/byteranges',
|
||||||
|
'Range': `bytes=${first}-${last}`,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
let buffer = await response.arrayBuffer();
|
||||||
|
|
||||||
|
this.parseHierarchy(node, buffer);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let tmpVec3 = new THREE.Vector3();
|
||||||
function createChildAABB(aabb, index){
|
function createChildAABB(aabb, index){
|
||||||
let min = aabb.min.clone();
|
let min = aabb.min.clone();
|
||||||
let max = aabb.max.clone();
|
let max = aabb.max.clone();
|
||||||
let size = new THREE.Vector3().subVectors(max, min);
|
let size = tmpVec3.subVectors(max, min);
|
||||||
|
|
||||||
if ((index & 0b0001) > 0) {
|
if ((index & 0b0001) > 0) {
|
||||||
min.z += size.z / 2;
|
min.z += size.z / 2;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user