Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- proj4.defs("EPSG:32633", "+proj=utm +zone=33 +datum=WGS84 +units=m +no_defs");
- proj4.defs('WGS84', "+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees");
- ...
- nodes.forEach(n => {
- var position = n.position;
- n.position = proj4('EPSG:32633', 'WGS84', position);
- });
- private static final CoordinateTransform transfGPS;
- static {
- final CoordinateTransformFactory ctFactory = new CoordinateTransformFactory();
- final CRSFactory crsFactory = new CRSFactory();
- final CoordinateReferenceSystem projWGS84 =
- crsFactory.createFromParameters("WGS84",
- "+title=long/lat:WGS84 +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees");
- final CoordinateReferenceSystem projEPSG32633 =
- crsFactory.createFromParameters("EPSG:32633",
- "+proj=utm +zone=33 +datum=WGS84 +units=m +no_defs");
- transfGPS = ctFactory.createTransform(projWGS84, projEPSG32633);
- }
- public static Point epanetToGps(Point position) {
- ProjCoordinate p1 = new ProjCoordinate();
- ProjCoordinate p2 = new ProjCoordinate();
- p1.x = position.getX();
- p1.y = position.getY();
- transfGPS.transform(p1, p2);
- return new Point(p2.x, p2.y);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement