-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from maRci002/feat/nadgrids
add nadgrids
- Loading branch information
Showing
15 changed files
with
731 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,29 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [{ | ||
"name": "Dart-proj4", | ||
"program": "example/proj4dart_example.dart", | ||
"request": "launch", | ||
"type": "dart" | ||
}, { | ||
"name": "Dart-ogc-wkt", | ||
"program": "example/proj4dart_ogc_wkt_example.dart", | ||
"request": "launch", | ||
"type": "dart" | ||
}, { | ||
"name": "Dart-esri-wkt", | ||
"program": "example/proj4dart_esri_wkt_example.dart", | ||
"request": "launch", | ||
"type": "dart" | ||
}] | ||
"configurations": [ | ||
{ | ||
"name": "Dart-proj4", | ||
"program": "example/proj4dart_example.dart", | ||
"request": "launch", | ||
"type": "dart" | ||
}, | ||
{ | ||
"name": "Dart-ogc-wkt", | ||
"program": "example/proj4dart_ogc_wkt_example.dart", | ||
"request": "launch", | ||
"type": "dart" | ||
}, | ||
{ | ||
"name": "Dart-esri-wkt", | ||
"program": "example/proj4dart_esri_wkt_example.dart", | ||
"request": "launch", | ||
"type": "dart" | ||
}, | ||
{ | ||
"name": "Dart-shift-grid", | ||
"program": "example/proj4dart_shift_grid_example.dart", | ||
"request": "launch", | ||
"type": "dart" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import 'dart:io'; | ||
|
||
import 'package:proj4dart/proj4dart.dart'; | ||
|
||
void main() async { | ||
// read bytes from filesystem | ||
// In case of Flutter assets: | ||
// import 'package:flutter/services.dart' show rootBundle; | ||
// final bytes = (await rootBundle.load(fileName)).buffer.asUint8List(); | ||
final bytes = await File( | ||
'test/test_resources/ntv2_0_downsampled.gsb', | ||
).readAsBytes(); | ||
|
||
// load nadgrid | ||
Projection.nadgrid('ntv2', bytes); | ||
|
||
// Define Point | ||
var pointSrc = Point(x: -44.382211538462, y: 40.3768); | ||
|
||
// Define some projection which has '+nadgrids=' | ||
var projSrc = Projection.add( | ||
'ntv2_from', | ||
'+proj=longlat +ellps=clrk66 +nadgrids=@ignorable,ntv2,null', | ||
); | ||
; | ||
|
||
// Use built-in projection | ||
var projDst = Projection.WGS84; | ||
|
||
// Forward transform (projected crs -> lonlat) | ||
var pointForward = projSrc.transform(projDst, pointSrc); | ||
print( | ||
'FORWARD: Transform point ${pointSrc.toArray()} from ntv2_from to WGS84: ${pointForward.toArray()}'); | ||
// FORWARD: Transform point [-44.382211538462, 40.3768] from ntv2_from to WGS84: [-44.38074905319326, 40.37745745991217] | ||
|
||
// Inverse transform (lonlat -> projected crs) | ||
var pointInverse = projDst.transform(projSrc, pointForward); | ||
print( | ||
'INVERSE: Transform point ${pointForward.toArray()} from WGS84 to ntv2_from: ${pointInverse.toArray()}'); | ||
// INVERSE: Transform point [-44.38074905319326, 40.37745745991217] from WGS84 to ntv2_from: [-44.38074905319326, 40.37745745991217] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.