You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now I am using Proj4Dart V2.0.0 & Flutter 3.0.4, found some big different of transform coordinates from my custom CRS. This is my code:
`import 'package:proj4dart/proj4dart.dart';
void main() {
var n1 = 1657193.5292;
var e1 = 834934.4417;
var ptSrc = Point(x: e1, y: n1);
var projSrc =
Projection.parse('+proj=utm +zone=47 +datum=WGS84 +units=m +no_defs');
var projDst = Projection.parse(
'+proj=tmerc +lat_0=0.0 +lon_0=102.25 +k_0=1.0 +x_0=500000 +y_0=0 +a=6378297.0 +b=6356911.77779 +towgs84=0.0,0.0,0.0,0,0,0,0 +units=m +no_defs type=crs');
var tuple = ProjectionTuple(fromProj: projSrc, toProj: projDst);
var ptDst = tuple.forward(ptSrc);
print(
'FORWARD: Transform point ${ptSrc.toArray()} from EPSG:32647 to custom projection: ${ptDst.toArray()}');
}
`
The console printed:
FORWARD: Transform point [834934.4417, 1657193.5292] from EPSG:32647 to custom projection: [485333.96880976285, 1655549.4642448912]
The correct answer must be [485333.9690, 1655549.7316].
This is very strange due to I used pyproj version of Python that derived from PROJ4 also but gave the correct coordinates.
This is my Python code with the same Proj4 strings:
`from pyproj import CRS, Transformer
You can run the above script in your browser's console (note: you cannot run on every site since this is script injection and some sites like github prevents it, so go for example to http://proj4js.org/ and press F12 and paste / run the above code snippet)
Anyway Python might use slightly different projection algorithm or Python might use higher/lower precision while calculating, the results almost the same I think the difference is still lower than 5mm which is insignificant if you think about it, it's a much bigger problem that the continents move from year to year.
Now I am using Proj4Dart V2.0.0 & Flutter 3.0.4, found some big different of transform coordinates from my custom CRS. This is my code:
`import 'package:proj4dart/proj4dart.dart';
void main() {
var n1 = 1657193.5292;
var e1 = 834934.4417;
var ptSrc = Point(x: e1, y: n1);
var projSrc =
Projection.parse('+proj=utm +zone=47 +datum=WGS84 +units=m +no_defs');
var projDst = Projection.parse(
'+proj=tmerc +lat_0=0.0 +lon_0=102.25 +k_0=1.0 +x_0=500000 +y_0=0 +a=6378297.0 +b=6356911.77779 +towgs84=0.0,0.0,0.0,0,0,0,0 +units=m +no_defs type=crs');
var tuple = ProjectionTuple(fromProj: projSrc, toProj: projDst);
var ptDst = tuple.forward(ptSrc);
print(
'FORWARD: Transform point ${ptSrc.toArray()} from EPSG:32647 to custom projection: ${ptDst.toArray()}');
}
`
The console printed:
FORWARD: Transform point [834934.4417, 1657193.5292] from EPSG:32647 to custom projection: [485333.96880976285, 1655549.4642448912]
The correct answer must be [485333.9690, 1655549.7316].
This is very strange due to I used pyproj version of Python that derived from PROJ4 also but gave the correct coordinates.
This is my Python code with the same Proj4 strings:
`from pyproj import CRS, Transformer
projsrc = CRS.from_proj4('+proj=utm +zone=47 +datum=WGS84 +units=m +no_defs')
projdst = CRS.from_proj4('+proj=tmerc +lat_0=0.0 +lon_0=102.25 +k_0=1.0 +x_0=500000 +y_0=0 +a=6378297.0 +b=6356911.77779 +towgs84=0.0,0.0,0.0,0,0,0,0 +units=m +no_defs type=crs');
xx, yy = 834934.4417, 1657193.5292
transformer = Transformer.from_crs(projsrc, projdst)
ptdst = transformer.transform(xx=xx, yy=yy)
print(f'Source point x,y: {xx} {yy}')
print(f'Dest point x,y: {ptdst[0]} {ptdst[1]}')`
The console of Python printed:
Source point x,y: 834934.4417 1657193.5292
Dest point x,y: 485333.9689740725 1655549.7315796772
I am new to Dart/Flutter what I am doing wrong or is it Proj4Dart's bug? Please help me. I run this code on Windows 11.
The text was updated successfully, but these errors were encountered: