Skip to content

Instantly share code, notes, and snippets.

@hiroyuki-sato
Created February 26, 2021 00:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hiroyuki-sato/1327ceb2bb25f2b33805fa7787296854 to your computer and use it in GitHub Desktop.
Save hiroyuki-sato/1327ceb2bb25f2b33805fa7787296854 to your computer and use it in GitHub Desktop.
EPSG:32654 -> EPSG:6677変換
/*
* This Java source file was generated by the Gradle 'init' task.
*/
package test;
import org.locationtech.proj4j.CRSFactory;
import org.locationtech.proj4j.CoordinateReferenceSystem;
import org.locationtech.proj4j.CoordinateTransform;
import org.locationtech.proj4j.CoordinateTransformFactory;
import org.locationtech.proj4j.ProjCoordinate;
public class App {
public static void main(String[] args) {
CoordinateReferenceSystem src, dst;
CRSFactory crsFactory = new CRSFactory();
src = crsFactory.createFromName("EPSG:32654");
dst = crsFactory.createFromName("EPSG:6677");
ProjCoordinate sproj = new ProjCoordinate(0,0);
ProjCoordinate dproj = new ProjCoordinate();
CoordinateTransformFactory factory = new CoordinateTransformFactory();
CoordinateTransform transform = factory.createTransform(src,dst);
transform.transform(sproj,dproj);
System.out.println(src.getParameterString());
System.out.println(dst.getParameterString());
System.out.println(dst);
System.out.println(dproj);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment