var spatialRef = new SpatialReference({wkid:yourSpatialReferenceHere}); map = new Map("map", { extent: Extent, spatialReference:spatialRef, lods:lods, logo: false, autoResize:true, sliderStyle: "large", displayGraphicsOnPan: false });
String toWKT(CoordinateReferenceSystem crs) { SpatialReference ref = new SpatialReference(); ref.ImportFromProj4(Proj.toString(crs)); return ref.ExportToWkt(); }
@Override protected void finalize() { delete(); }
public static SpatialReference getSpatialReference(final int srid) { final SpatialReference spatialReference = new SpatialReference(""); spatialReference.ImportFromEPSG(srid); return spatialReference; }
SpatialReference sr = new SpatialReference(); sr.ImportFromProj4("+proj=merc +datum=WGS84"); String result[] = new String[1]; sr.ExportToPrettyWkt(result, 1); String oldProjection = mDataset.getProjection(); String newProjection = result[0]; Dataset newDataset = gdal.AutoCreateWarpedVRT(mDataset, oldProjection, newProjection, gdalconst.GRA_NearestNeighbour, 0.0); Dataset savedDataset = mDriver.CreateCopy(outpath, newDataset, 0, new String[] { "COMPRESS=LZW", "PREDICTOR=2" }, null, null); newDataset.delete(); savedDataset.delete();
/** * Creates a new coordinate reference system. * * @param srs the GDAL spatial reference system information. * @return the Well Known Text (WKT) given by GDAL, or {@code null} if unsupported. */ static CRS create(final String wkt) { if (wkt != null && !wkt.isEmpty()) { final SpatialReference srs = new SpatialReference(wkt); try { if (srs.IsGeographic() != 0) { return new Geographic(wkt, srs); } else if (srs.IsProjected() != 0) { return new Projected(wkt, srs); } else { // TODO: we could also check IsGeocentric(), IsLocal() and IsCompound(). } } finally { srs.delete(); } } return null; }
@Override public CoordinateReferenceSystem crs() throws IOException { String proj = dataset.GetProjection(); if (proj != null) { SpatialReference ref = new SpatialReference(proj); return Proj.crs(ref.ExportToProj4()); } return null; }
public String ExportToWkt() { final String array[] = new String[] { null }; ExportToWkt(array); return array[0]; }
SpatialReference sourceReference = new SpatialReference(sourceWkt); SpatialReference destinationReference = new SpatialReference(destinationWkt); if (sourceReference.IsSame(destinationReference) == 0) { dataset = gdal.AutoCreateWarpedVRT( dataset,
sref.AutoIdentifyEPSG(); String code = sref.GetAuthorityCode(null); if (code != null) { crs = Proj.crs("epsg:" + code); crs = Proj.crs(sref.ExportToProj4());
public String ExportToPrettyWkt(int simplify) { String array[] = new String[] {null}; ExportToPrettyWkt(array, simplify); return array[0]; }
public String ExportToProj4() { String array[] = new String[] {null}; ExportToProj4(array); return array[0]; }
public String ExportToMICoordSys() { String array[] = new String[] {null}; ExportToMICoordSys(array); return array[0]; }
@Override public Object clone() { return Clone(); }
public SpatialReference getCrsAsWkt( int epsgCode ) { SpatialReference sr = epsgCodeToSpatialReference.get( epsgCode ); if ( sr == null ) { synchronized ( this ) { sr = new SpatialReference(); int importFromEPSG = sr.ImportFromEPSG( epsgCode ); if ( importFromEPSG != 0 ) { throw new RuntimeException( "Cannot import EPSG:" + epsgCode + " from GDAL." ); } epsgCodeToSpatialReference.put( epsgCode, sr ); } } return sr; }
public String ExportToWkt() { String array[] = new String[] {null}; ExportToWkt(array); return array[0]; }
public String ExportToPrettyWkt() { String array[] = new String[] {null}; ExportToPrettyWkt(array); return array[0]; }
public String ExportToProj4() { final String array[] = new String[] { null }; ExportToProj4(array); return array[0]; }
public String ExportToMICoordSys() { final String array[] = new String[] { null }; ExportToMICoordSys(array); return array[0]; }
public Object clone() { return Clone(); }