Tabnine Logo
CRS.getSupportedCodes
Code IndexAdd Tabnine to your IDE (free)

How to use
getSupportedCodes
method
in
org.geotools.referencing.CRS

Best Java code snippets using org.geotools.referencing.CRS.getSupportedCodes (Showing top 8 results out of 315)

origin: geotools/geotools

@Test
public void testCodeInList() {
  Set<String> supportedCodes = CRS.getSupportedCodes("EPSG");
  assertTrue(supportedCodes.contains(CODE));
}
origin: org.geoserver.web/web-core

static List<SRS> buildCodeList() {
  long t = System.currentTimeMillis();
  Set<String> codes = CRS.getSupportedCodes("EPSG");
  try {
    codes.addAll(customFactory.getAuthorityCodes(CoordinateReferenceSystem.class));
  } catch (FactoryException e) {
    LOGGER.log(Level.WARNING, "Error occurred while trying to gather custom CRS codes", e);
  }
  // make a set with each code
  Set<SRS> idSet = new HashSet<SRS>();
  for (String code : codes) {
    // make sure we're using just the non prefix part
    String id = code.substring(code.indexOf(':') + 1);
    // avoid WGS84DD and eventual friends, as we're still not able to handle them,
    // if they are chosen exceptions arises everywhere
    if (NUMERIC.matcher(id).matches()) {
      idSet.add(new SRS(id));
    }
  }
  List<SRS> srsList = new ArrayList<SRS>(idSet);
  Collections.sort(srsList, new CodeComparator()); // sort to get them in order
  return srsList;
}
origin: org.geoserver.web/gs-web-core

static List<SRS> buildCodeList() {
  // long t = System.currentTimeMillis();
  Set<String> codes = CRS.getSupportedCodes("EPSG");
  try {
    codes.addAll(customFactory.getAuthorityCodes(CoordinateReferenceSystem.class));
  } catch (FactoryException e) {
    LOGGER.log(Level.WARNING, "Error occurred while trying to gather custom CRS codes", e);
  }
  // make a set with each code
  Set<SRS> idSet = new HashSet<SRS>();
  for (String code : codes) {
    // make sure we're using just the non prefix part
    String id = code.substring(code.indexOf(':') + 1);
    // avoid WGS84DD and eventual friends, as we're still not able to handle them,
    // if they are chosen exceptions arises everywhere
    if (NUMERIC.matcher(id).matches()) {
      idSet.add(new SRS(id));
    }
  }
  List<SRS> srsList = new ArrayList<SRS>(idSet);
  Collections.sort(srsList, new CodeComparator()); // sort to get them in order
  return srsList;
}
origin: org.geoserver/gs-wms

  comment("All supported EPSG projections:");
  capabilitiesCrsIdentifiers = new LinkedHashSet<String>();
  for (String code : CRS.getSupportedCodes("AUTO")) {
    if ("WGS84(DD)".equals(code)) continue;
    capabilitiesCrsIdentifiers.add("AUTO:" + code);
  capabilitiesCrsIdentifiers.addAll(CRS.getSupportedCodes("EPSG"));
} else {
  comment("Limited list of EPSG projections:");
origin: org.geoserver/wms

if(epsgCodes.isEmpty()){
  comment("All supported EPSG projections:");
  capabilitiesCrsIdentifiers = CRS.getSupportedCodes("EPSG");
}else{
  comment("Limited list of EPSG projections:");
origin: org.geoserver/gs-wms

  comment("All supported EPSG projections:");
  capabilitiesCrsIdentifiers = new LinkedHashSet<String>();
  for (String code : CRS.getSupportedCodes("AUTO")) {
    if ("WGS84(DD)".equals(code)) continue;
    capabilitiesCrsIdentifiers.add("AUTO:" + code);
  capabilitiesCrsIdentifiers.addAll(CRS.getSupportedCodes("EPSG"));
} else {
  comment("Limited list of EPSG projections:");
origin: org.geoserver/gs-wms

@Test
public void testCRSList() throws Exception {
  GetCapabilitiesTransformer tr;
  tr = new GetCapabilitiesTransformer(wmsConfig, baseUrl, mapFormats, legendFormats, null);
  tr.setIndentation(2);
  Document dom = WMSTestSupport.transform(req, tr);
  final Set<String> supportedCodes = CRS.getSupportedCodes("EPSG");
  supportedCodes.addAll(CRS.getSupportedCodes("AUTO"));
  NodeList allCrsCodes =
      XPATH.getMatchingNodes("/WMT_MS_Capabilities/Capability/Layer/SRS", dom);
  assertEquals(supportedCodes.size() - 1 /* WGS84(DD) */, allCrsCodes.getLength());
}
origin: org.geoserver/gs-wcs2_0

  codes = CRS.getSupportedCodes("EPSG");
} else {
  codes = wcs.getSRS();
org.geotools.referencingCRSgetSupportedCodes

Javadoc

Get the list of the codes that are supported by the given authority. For example getSupportedCodes("EPSG") may returns "EPSG:2000", "EPSG:2001", "EPSG:2002", etc. It may also returns "2000", "2001", "2002", etc. without the "EPSG:" prefix. Whatever the authority name is prefixed or not is factory implementation dependent.

If there is more than one factory for the given authority, then this method merges the code set of all of them. If a factory fails to provide a set of supported code, then this particular factory is ignored. Please be aware of the following potential issues:

  • If there is more than one EPSG databases (for example an org.geotools.referencing.factory.epsg.AccessDataSource and a org.geotools.referencing.factory.epsg.PostgreDataSource ones), then this method will connect to all of them even if their content are identical.
  • If two factories format their codes differently (e.g. "4326" and "EPSG:4326"), then the returned set will contain a lot of synonymous codes.
  • For any code c in the returned set, there is no warranty that #decode(c) will use the same authority factory than the one that formatted c.
  • This method doesn't report connection problems since it doesn't throw any exception. FactoryExceptions are logged as warnings and otherwise ignored.

If a more determinist behavior is wanted, consider the code below instead. The following code exploit only one factory, the "preferred" one.

CRSAuthorityFactory factory = FactoryFinder. ReferencingFactoryFinder#getCRSAuthorityFactory(authority, null);
Set<String> codes = factory. CRSAuthorityFactory#getAuthorityCodes(CoordinateReferenceSystem.class);
String code = ...choose a code here...
CoordinateReferenceSystem crs = factory.createCoordinateReferenceSystem(code);

Popular methods of CRS

  • decode
  • findMathTransform
  • equalsIgnoreMetadata
  • parseWKT
  • lookupEpsgCode
  • transform
  • getAxisOrder
  • lookupIdentifier
  • toSRS
  • getHorizontalCRS
  • getEnvelope
  • getCoordinateOperationFactory
  • getEnvelope,
  • getCoordinateOperationFactory,
  • getAuthorityFactory,
  • getMapProjection,
  • getGeographicBoundingBox,
  • reset,
  • getEllipsoid,
  • getProjectedCRS,
  • getTemporalCRS

Popular in Java

  • Creating JSON documents from java classes using gson
  • onRequestPermissionsResult (Fragment)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • notifyDataSetChanged (ArrayAdapter)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • String (java.lang)
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now