org.osgeo.proj4j.util.CRSCache Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of geotrellis-proj4_2.11 Show documentation
Show all versions of geotrellis-proj4_2.11 Show documentation
GeoTrellis is an open source geographic data processing engine for high performance applications.
package org.osgeo.proj4j.util;
import java.util.HashMap;
import java.util.Map;
import org.osgeo.proj4j.*;
public class CRSCache
{
private static Map projCache = new HashMap();
private static CRSFactory crsFactory = new CRSFactory();
// TODO: provide limit on number of items in cache (LRU)
public CRSCache() {
super();
}
public CoordinateReferenceSystem createFromName(String name)
throws UnsupportedParameterException, InvalidValueException, UnknownAuthorityCodeException
{
CoordinateReferenceSystem proj = (CoordinateReferenceSystem) projCache.get(name);
if (proj == null) {
proj = crsFactory.createFromName(name);
projCache.put(name, proj);
}
return proj;
}
}