/** * copy constructor - avoid clone !! * * @return _more_ */ public ProjectionImpl constructCopy() { return new TransverseMercator(getOriginLat(), getTangentLon(), getScale(), getFalseEasting(), getFalseNorthing()); }
/** * Construct a TransverseMercator Projection. * * @param lat0 origin of projection coord system is at (lat0, tangentLon) * @param tangentLon longitude that the cylinder is tangent at ("central meridian") * @param scale scale factor along the central meridian * @param east false easting in units of km * @param north false northing in units of km * @param radius earth radius in km */ public TransverseMercator(double lat0, double tangentLon, double scale, double east, double north, double radius) { super("TransverseMercator", false); this.lat0 = Math.toRadians(lat0); this.lon0 = Math.toRadians(tangentLon); this.earthRadius = radius; this.scale = scale * earthRadius; this.falseEasting = (!Double.isNaN(east)) ? east : 0.0; this.falseNorthing = (!Double.isNaN(north)) ? north : 0.0; addParameter(CF.GRID_MAPPING_NAME, CF.TRANSVERSE_MERCATOR); addParameter(CF.LONGITUDE_OF_CENTRAL_MERIDIAN, tangentLon); addParameter(CF.LATITUDE_OF_PROJECTION_ORIGIN, lat0); addParameter(CF.SCALE_FACTOR_AT_CENTRAL_MERIDIAN, scale); addParameter(CF.EARTH_RADIUS, earthRadius * 1000); if ((falseEasting != 0.0) || (falseNorthing != 0.0)) { addParameter(CF.FALSE_EASTING, falseEasting); addParameter(CF.FALSE_NORTHING, falseNorthing); addParameter(CDM.UNITS, "km"); } }
/** * Get the parameters as a String * * @return the parameters as a String */ public String paramsToString() { return toString(); }
/** * Returns true if this represents the same Projection as proj. * * @param proj projection in question * @return true if this represents the same Projection as proj. */ public boolean equals(Object proj) { if ( !(proj instanceof TransverseMercator)) { return false; } TransverseMercator oo = (TransverseMercator) proj; return ((this.getScale() == oo.getScale()) && (this.getOriginLat() == oo.getOriginLat()) && (this.getTangentLon() == oo.getTangentLon()) && (this.falseEasting == falseEasting) && (this.falseNorthing == falseNorthing) && this.defaultMapArea.equals(oo.defaultMapArea)); }
/** * Clone this projection * * @return a clone of this. */ public Object clone() { TransverseMercator cl = (TransverseMercator) super.clone(); cl.origin = new LatLonPointImpl(getOriginLat(), getTangentLon()); cl.falseEasting = falseEasting; cl.falseNorthing = falseNorthing; return cl; }
private CoordinateTransform makeTransverseMercatorProjection(NetcdfDataset ds) { double lat0 = findAttributeDouble(ds, "P_ALP"); double tangentLon = findAttributeDouble(ds, "P_GAM"); TransverseMercator p = new TransverseMercator(lat0, tangentLon, 1.0, 0.0, 0.0, earthRadius); return new ProjectionCT("TransverseMercator", "FGDC", p); }
@Test public void testTM() { testProjection(new TransverseMercator()); TransverseMercator p = new TransverseMercator(); TransverseMercator p2 = (TransverseMercator) p.constructCopy(); assert p.equals(p2); }
/** * Get the parameters as a String * * @return the parameters as a String */ public String paramsToString() { return " origin " + origin.toString() + " scale: " + Format.d(getScale(), 6); }
@Override protected TransverseMercator createProjection(final ParameterValueGroup p) { if (p == null) return new TransverseMercator(); return new TransverseMercator(value(p, CF.LATITUDE_OF_PROJECTION_ORIGIN), value(p, CF.LONGITUDE_OF_CENTRAL_MERIDIAN), value(p, CF.SCALE_FACTOR_AT_CENTRAL_MERIDIAN), value(p, CF.FALSE_EASTING) / KILOMETRE, value(p, CF.FALSE_NORTHING) / KILOMETRE, earthRadius(p) / KILOMETRE); } }
private void addTransverseMercatorTags(TransverseMercator proj) { geotiff.addGeoKey(new GeoKey(GeoKey.Tag.GTModelTypeGeoKey, GeoKey.TagValue.ModelType_Projected)); geotiff.addGeoKey(new GeoKey(GeoKey.Tag.GTRasterTypeGeoKey, GeoKey.TagValue.RasterType_Area)); // define the "geographic Coordinate System" geotiff.addGeoKey(new GeoKey(GeoKey.Tag.GeographicTypeGeoKey, GeoKey.TagValue.GeographicType_WGS_84)); geotiff.addGeoKey(new GeoKey(GeoKey.Tag.GeogLinearUnitsGeoKey, GeoKey.TagValue.ProjLinearUnits_METER)); geotiff.addGeoKey(new GeoKey(GeoKey.Tag.GeogAngularUnitsGeoKey, GeoKey.TagValue.GeogAngularUnits_DEGREE)); // define the "coordinate transformation" geotiff.addGeoKey(new GeoKey(GeoKey.Tag.ProjectedCSTypeGeoKey, GeoKey.TagValue.ProjectedCSType_UserDefined)); geotiff.addGeoKey(new GeoKey(GeoKey.Tag.PCSCitationGeoKey, "Transvers Mercator")); geotiff.addGeoKey(new GeoKey(GeoKey.Tag.ProjectionGeoKey, GeoKey.TagValue.ProjectedCSType_UserDefined)); geotiff.addGeoKey(new GeoKey(GeoKey.Tag.ProjLinearUnitsGeoKey, GeoKey.TagValue.ProjLinearUnits_METER)); //geotiff.addGeoKey( new GeoKey( GeoKey.Tag.ProjLinearUnitsSizeGeoKey, 1.0)); // units of km // the specifics for mercator geotiff.addGeoKey(new GeoKey(GeoKey.Tag.ProjCoordTransGeoKey, GeoKey.TagValue.ProjCoordTrans_TransverseMercator)); geotiff.addGeoKey(new GeoKey(GeoKey.Tag.ProjNatOriginLatGeoKey, proj.getOriginLat())); geotiff.addGeoKey(new GeoKey(GeoKey.Tag.ProjNatOriginLongGeoKey, proj.getTangentLon())); geotiff.addGeoKey(new GeoKey(GeoKey.Tag.ProjScaleAtNatOriginGeoKey, proj.getScale())); geotiff.addGeoKey(new GeoKey(GeoKey.Tag.ProjScaleAtNatOriginGeoKey, 1.0)); geotiff.addGeoKey(new GeoKey(GeoKey.Tag.ProjFalseEastingGeoKey, 0.0)); geotiff.addGeoKey(new GeoKey(GeoKey.Tag.ProjFalseNorthingGeoKey, 0.0)); }
@Override public ProjectionImpl constructCopy() { ProjectionImpl result = new TransverseMercator(getOriginLat(), getTangentLon(), getScale(), getFalseEasting(), getFalseNorthing(), getEarthRadius()); result.setDefaultMapArea(defaultMapArea); result.setName(name); return result; }
proj = new LambertConformal(p[0], p[1], p[2], p[3]); else if (projection.equalsIgnoreCase("TransverseMercator")) proj = new TransverseMercator(p[0], p[1], p[2]); else if (projection.equalsIgnoreCase("Stereographic") || projection.equalsIgnoreCase("Oblique_Stereographic")) proj = new Stereographic(p[0], p[1], p[2]);
private void addTransverseMercatorTags(TransverseMercator proj) { geotiff.addGeoKey(new GeoKey(GeoKey.Tag.GTModelTypeGeoKey, GeoKey.TagValue.ModelType_Projected)); geotiff.addGeoKey(new GeoKey(GeoKey.Tag.GTRasterTypeGeoKey, GeoKey.TagValue.RasterType_Area)); // define the "geographic Coordinate System" geotiff.addGeoKey(new GeoKey(GeoKey.Tag.GeographicTypeGeoKey, GeoKey.TagValue.GeographicType_WGS_84)); geotiff.addGeoKey(new GeoKey(GeoKey.Tag.GeogLinearUnitsGeoKey, GeoKey.TagValue.ProjLinearUnits_METER)); geotiff.addGeoKey(new GeoKey(GeoKey.Tag.GeogAngularUnitsGeoKey, GeoKey.TagValue.GeogAngularUnits_DEGREE)); // define the "coordinate transformation" geotiff.addGeoKey(new GeoKey(GeoKey.Tag.ProjectedCSTypeGeoKey, GeoKey.TagValue.ProjectedCSType_UserDefined)); geotiff.addGeoKey(new GeoKey(GeoKey.Tag.PCSCitationGeoKey, "Transvers Mercator")); geotiff.addGeoKey(new GeoKey(GeoKey.Tag.ProjectionGeoKey, GeoKey.TagValue.ProjectedCSType_UserDefined)); geotiff.addGeoKey(new GeoKey(GeoKey.Tag.ProjLinearUnitsGeoKey, GeoKey.TagValue.ProjLinearUnits_METER)); //geotiff.addGeoKey( new GeoKey( GeoKey.Tag.ProjLinearUnitsSizeGeoKey, 1.0)); // units of km // the specifics for mercator geotiff.addGeoKey(new GeoKey(GeoKey.Tag.ProjCoordTransGeoKey, GeoKey.TagValue.ProjCoordTrans_TransverseMercator)); geotiff.addGeoKey(new GeoKey(GeoKey.Tag.ProjNatOriginLatGeoKey, proj.getOriginLat())); geotiff.addGeoKey(new GeoKey(GeoKey.Tag.ProjNatOriginLongGeoKey, proj.getTangentLon())); geotiff.addGeoKey(new GeoKey(GeoKey.Tag.ProjScaleAtNatOriginGeoKey, proj.getScale())); geotiff.addGeoKey(new GeoKey(GeoKey.Tag.ProjScaleAtNatOriginGeoKey, 1.0)); geotiff.addGeoKey(new GeoKey(GeoKey.Tag.ProjFalseEastingGeoKey, 0.0)); geotiff.addGeoKey(new GeoKey(GeoKey.Tag.ProjFalseNorthingGeoKey, 0.0)); }
/** * Construct a TransverseMercator Projection. * * @param lat0 origin of projection coord system is at (lat0, tangentLon) * @param tangentLon longitude that the cylinder is tangent at ("central meridian") * @param scale scale factor along the central meridian * @param east false easting in units of km * @param north false northing in units of km * @param radius earth radius in km */ public TransverseMercator(double lat0, double tangentLon, double scale, double east, double north, double radius) { super("TransverseMercator", false); this.lat0 = Math.toRadians(lat0); this.lon0 = Math.toRadians(tangentLon); this.earthRadius = radius; this.scale = scale * earthRadius; this.falseEasting = (!Double.isNaN(east)) ? east : 0.0; this.falseNorthing = (!Double.isNaN(north)) ? north : 0.0; addParameter(CF.GRID_MAPPING_NAME, CF.TRANSVERSE_MERCATOR); addParameter(CF.LONGITUDE_OF_CENTRAL_MERIDIAN, tangentLon); addParameter(CF.LATITUDE_OF_PROJECTION_ORIGIN, lat0); addParameter(CF.SCALE_FACTOR_AT_CENTRAL_MERIDIAN, scale); addParameter(CF.EARTH_RADIUS, earthRadius * 1000); if ((falseEasting != 0.0) || (falseNorthing != 0.0)) { addParameter(CF.FALSE_EASTING, falseEasting); addParameter(CF.FALSE_NORTHING, falseNorthing); addParameter(CDM.UNITS, "km"); } }
/** * Get the parameters as a String * * @return the parameters as a String */ public String paramsToString() { return toString(); }
@Override public ProjectionImpl constructCopy() { ProjectionImpl result = new TransverseMercator(getOriginLat(), getTangentLon(), getScale(), getFalseEasting(), getFalseNorthing(), getEarthRadius()); result.setDefaultMapArea(defaultMapArea); result.setName(name); return result; }
private CoordinateTransform makeTransverseMercatorProjection(NetcdfDataset ds) { double lat0 = findAttributeDouble(ds, "P_ALP"); double tangentLon = findAttributeDouble(ds, "P_GAM"); TransverseMercator p = new TransverseMercator(lat0, tangentLon, 1.0, 0.0, 0.0, earthRadius); return new ProjectionCT("TransverseMercator", "FGDC", p); }
private void addTransverseMercatorTags(TransverseMercator proj) { geotiff.addGeoKey(new GeoKey(GeoKey.Tag.GTModelTypeGeoKey, GeoKey.TagValue.ModelType_Projected)); geotiff.addGeoKey(new GeoKey(GeoKey.Tag.GTRasterTypeGeoKey, GeoKey.TagValue.RasterType_Area)); // define the "geographic Coordinate System" geotiff.addGeoKey(new GeoKey(GeoKey.Tag.GeographicTypeGeoKey, GeoKey.TagValue.GeographicType_WGS_84)); geotiff.addGeoKey(new GeoKey(GeoKey.Tag.GeogLinearUnitsGeoKey, GeoKey.TagValue.ProjLinearUnits_METER)); geotiff.addGeoKey(new GeoKey(GeoKey.Tag.GeogAngularUnitsGeoKey, GeoKey.TagValue.GeogAngularUnits_DEGREE)); // define the "coordinate transformation" geotiff.addGeoKey(new GeoKey(GeoKey.Tag.ProjectedCSTypeGeoKey, GeoKey.TagValue.ProjectedCSType_UserDefined)); geotiff.addGeoKey(new GeoKey(GeoKey.Tag.PCSCitationGeoKey, "Transvers Mercator")); geotiff.addGeoKey(new GeoKey(GeoKey.Tag.ProjectionGeoKey, GeoKey.TagValue.ProjectedCSType_UserDefined)); geotiff.addGeoKey(new GeoKey(GeoKey.Tag.ProjLinearUnitsGeoKey, GeoKey.TagValue.ProjLinearUnits_METER)); //geotiff.addGeoKey( new GeoKey( GeoKey.Tag.ProjLinearUnitsSizeGeoKey, 1.0)); // units of km // the specifics for mercator geotiff.addGeoKey(new GeoKey(GeoKey.Tag.ProjCoordTransGeoKey, GeoKey.TagValue.ProjCoordTrans_TransverseMercator)); geotiff.addGeoKey(new GeoKey(GeoKey.Tag.ProjNatOriginLatGeoKey, proj.getOriginLat())); geotiff.addGeoKey(new GeoKey(GeoKey.Tag.ProjNatOriginLongGeoKey, proj.getTangentLon())); geotiff.addGeoKey(new GeoKey(GeoKey.Tag.ProjScaleAtNatOriginGeoKey, proj.getScale())); geotiff.addGeoKey(new GeoKey(GeoKey.Tag.ProjScaleAtNatOriginGeoKey, 1.0)); geotiff.addGeoKey(new GeoKey(GeoKey.Tag.ProjFalseEastingGeoKey, 0.0)); geotiff.addGeoKey(new GeoKey(GeoKey.Tag.ProjFalseNorthingGeoKey, 0.0)); }
/** * Construct a TransverseMercator Projection. * * @param lat0 origin of projection coord system is at * (lat0, tangentLon) * @param tangentLon longitude that the cylinder is tangent at * ("central meridian") * @param scale scale factor along the central meridian */ public TransverseMercator(double lat0, double tangentLon, double scale) { this.lat0 = Math.toRadians(lat0); this.lon0 = Math.toRadians(tangentLon); this.scale = scale * EARTH_RADIUS; origin = new LatLonPointImpl(lat0, tangentLon); addParameter(ATTR_NAME, "transverse_mercator"); addParameter("longitude_of_central_meridian", tangentLon); addParameter("latitude_of_projection_origin", lat0); addParameter("scale_factor_at_central_meridian", scale); }
/** * Get the parameters as a String * * @return the parameters as a String */ public String paramsToString() { return toString(); }