org.geotools.referencing.CRS.getAuthorityFactory()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(299)

本文整理了Java中org.geotools.referencing.CRS.getAuthorityFactory()方法的一些代码示例,展示了CRS.getAuthorityFactory()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。CRS.getAuthorityFactory()方法的具体详情如下:
包路径:org.geotools.referencing.CRS
类名称:CRS
方法名:getAuthorityFactory

CRS.getAuthorityFactory介绍

[英]Returns the CRS authority factory used by the #decode(String,boolean) methods. This factory is org.geotools.referencing.factory.BufferedAuthorityFactory, scans over org.geotools.referencing.factory.AllAuthoritiesFactory and uses additional factories as org.geotools.referencing.factory.FallbackAuthorityFactory if there is more than one ReferencingFactoryFinder#getCRSAuthorityFactories for the same authority.

This factory can be used as a kind of system-wide factory for all authorities. However for more determinist behavior, consider using a more specific factory (as returned by ReferencingFactoryFinder#getCRSAuthorityFactory when the authority in known.
[中]返回#decode(String,boolean)方法使用的CRS授权工厂。这家工厂是有组织的。地理工具。参考。工厂BufferedAuthorityFactory,通过组织进行扫描。地理工具。参考。工厂AllAuthoritiesFactory并使用其他工厂作为组织。地理工具。参考。工厂FallbackAuthorityFactory如果同一权限有多个ReferencengFactoryFinder#GetCrsAuthorityFactory。
该工厂可作为一种适用于所有机构的系统级工厂。然而,对于更具决定论的行为,考虑使用一个更具体的工厂(如在已知权限时引用引用CyfCytoFyfFier-GyrCurthTurthPrimeCurror)。

代码示例

代码示例来源:origin: geotools/geotools

  1. /** Creates an instance of the specified authority. */
  2. private Command(final String authority) {
  3. factory =
  4. (authority == null)
  5. ? CRS.getAuthorityFactory(false)
  6. : ReferencingFactoryFinder.getCRSAuthorityFactory(authority, HINTS);
  7. formatter = new Parser();
  8. }

代码示例来源:origin: geotools/geotools

  1. /** Prints all {@linkplain AuthorityFactory authority factory} dependencies as a tree. */
  2. private static void printAuthorityFactoryDependencies(
  3. final PrintWriter out, final boolean colors) {
  4. final FactoryDependencies printer = new FactoryDependencies(CRS.getAuthorityFactory(false));
  5. printer.setAttributeEnabled(true);
  6. printer.setColorEnabled(colors);
  7. printer.print(out);
  8. out.flush();
  9. }

代码示例来源:origin: geotools/geotools

  1. (AbstractAuthorityFactory) getAuthorityFactory(true);
  2. final IdentifiedObjectFinder finder =
  3. xyFactory.getIdentifiedObjectFinder(object.getClass());

代码示例来源:origin: geotools/geotools

  1. result = getAuthorityFactory(longitudeFirst).createCoordinateReferenceSystem(code);
  2. if (longitudeFirst) {
  3. defaultCache.put(code, result);

代码示例来源:origin: geotools/geotools

  1. @Test
  2. public void testTransformBBOXIsCorrect() throws Exception {
  3. Style style = RendererBaseTest.loadStyle(this, "noop_colormap.sld");
  4. GeoTiffReader reader = new GeoTiffReader(TestData.file(this, "watertemp.tiff"));
  5. MapContent mc = new MapContent();
  6. mc.addLayer(new GridReaderLayer(reader, style));
  7. StreamingRenderer renderer = new StreamingRenderer();
  8. renderer.setMapContent(mc);
  9. CRSAuthorityFactory factory = CRS.getAuthorityFactory(true);
  10. CoordinateReferenceSystem crs = factory.createCoordinateReferenceSystem("EPSG:4326");
  11. ReferencedEnvelope reWgs84 =
  12. new ReferencedEnvelope(
  13. 9.848993475036622,
  14. 11.958867853088378,
  15. 40.74254816253662,
  16. 41.64941961090088,
  17. crs);
  18. BufferedImage image =
  19. RendererBaseTest.showRender("Transform BBOX", renderer, 4000, reWgs84);
  20. // last pixel is white when doing a transformation and the rendering transform BBOX
  21. // transforms are
  22. // incorrect, it shouldn't be
  23. assertNotEquals(Color.WHITE, getPixelColor(image, 299, 0));
  24. assertEquals(new Color(133, 130, 188), getPixelColor(image, 299, 0));
  25. }

代码示例来源:origin: org.geoserver.web/web-core

  1. public String getDescription() {
  2. // lazy loading of description
  3. if (description == null) {
  4. // grab the description
  5. String desc = "-";
  6. try {
  7. // REVISIT: as far as I know the EPSG names are not localized? anyway, if
  8. // they're revisit to use the page locale
  9. // description = CRS.getAuthorityFactory(true).getDescriptionText("EPSG:" +
  10. // code)
  11. // .toString(getLocale()).toUpperCase();
  12. desc = CRS.getAuthorityFactory(true).getDescriptionText("EPSG:" + code)
  13. .toString();
  14. } catch (Exception e) {
  15. // no problem
  16. }
  17. description = desc;
  18. }
  19. return description;
  20. }

代码示例来源:origin: org.locationtech.geogig/geogig-core

  1. /**
  2. * Search for the given CRS (EPSG code), return the bounds (domain of validity)
  3. *
  4. * @param refId the input CRS
  5. * @return projectionBounds an Envelope describing the CRS bounds, throws
  6. * a NoSuchAuthorityException, a CRSException, or a TransformException if the CRS cannot be found
  7. */
  8. public Envelope getCRSBounds(String refId)
  9. throws CRSException, FactoryException, TransformException {
  10. CRSAuthorityFactory authorityFactory = CRS.getAuthorityFactory(true);
  11. CoordinateReferenceSystem crs = authorityFactory.createCoordinateReferenceSystem(refId);
  12. return getExtents(crs);
  13. }

代码示例来源:origin: locationtech/geogig

  1. /**
  2. * Search for the given CRS (EPSG code), return the bounds (domain of validity)
  3. *
  4. * @param refId the input CRS
  5. * @return projectionBounds an Envelope describing the CRS bounds, throws
  6. * a NoSuchAuthorityException, a CRSException, or a TransformException if the CRS cannot be found
  7. */
  8. public Envelope getCRSBounds(String refId)
  9. throws CRSException, FactoryException, TransformException {
  10. CRSAuthorityFactory authorityFactory = CRS.getAuthorityFactory(true);
  11. CoordinateReferenceSystem crs = authorityFactory.createCoordinateReferenceSystem(refId);
  12. return getExtents(crs);
  13. }

代码示例来源:origin: matsim-org/matsim

  1. /**
  2. * Retrieves the coordinate reference system from the EPSG database.
  3. *
  4. * @param srid
  5. * the spatial reference id.
  6. *
  7. * @return a coordinate reference system.
  8. */
  9. public static CoordinateReferenceSystem getCRS(int srid) {
  10. CoordinateReferenceSystem crs = crsMappings.get(srid);
  11. if (crs == null) {
  12. /*
  13. * Force longitude/latitude order.
  14. */
  15. CRSAuthorityFactory factory = CRS.getAuthorityFactory(true);
  16. try {
  17. crs = factory.createCoordinateReferenceSystem("EPSG:" + srid);
  18. } catch (NoSuchAuthorityCodeException e) {
  19. logger.warn(e.getLocalizedMessage());
  20. } catch (FactoryException e) {
  21. e.printStackTrace();
  22. }
  23. }
  24. return crs;
  25. }

代码示例来源:origin: org.geoserver.web/gs-web-core

  1. public String getDescription() {
  2. // lazy loading of description
  3. if (description == null) {
  4. // grab the description
  5. String desc = "-";
  6. try {
  7. // REVISIT: as far as I know the EPSG names are not localized? anyway, if
  8. // they're revisit to use the page locale
  9. // description = CRS.getAuthorityFactory(true).getDescriptionText("EPSG:" +
  10. // code)
  11. // .toString(getLocale()).toUpperCase();
  12. desc =
  13. CRS.getAuthorityFactory(true)
  14. .getDescriptionText("EPSG:" + code)
  15. .toString();
  16. } catch (Exception e) {
  17. // no problem
  18. }
  19. description = desc;
  20. }
  21. return description;
  22. }

代码示例来源:origin: matsim-org/matsim

  1. /**
  2. * Retrieves the coordinate reference system from the EPSG database.
  3. *
  4. * @param srid
  5. * the spatial reference id.
  6. *
  7. * @return a coordinate reference system.
  8. */
  9. public static CoordinateReferenceSystem getCRS(int srid) {
  10. CoordinateReferenceSystem crs = crsMappings.get(srid);
  11. if (crs == null) {
  12. /*
  13. * Force longitude/latitude order.
  14. */
  15. CRSAuthorityFactory factory = CRS.getAuthorityFactory(true);
  16. try {
  17. crs = factory.createCoordinateReferenceSystem("EPSG:" + srid);
  18. } catch (NoSuchAuthorityCodeException e) {
  19. logger.warn(e.getLocalizedMessage());
  20. } catch (FactoryException e) {
  21. e.printStackTrace();
  22. }
  23. }
  24. return crs;
  25. }

代码示例来源:origin: org.geoserver.community/gs-gpxppio

  1. public void encode(OutputStream lFileOutputStream, SimpleFeatureCollection collection)
  2. throws XMLStreamException, NoSuchAuthorityCodeException, FactoryException {
  3. CRSAuthorityFactory crsFactory = CRS.getAuthorityFactory(true);

代码示例来源:origin: com.conveyal/gtfs-lib

  1. CRS.getAuthorityFactory(false);

代码示例来源:origin: org.geoserver.web/gs-web-demo

  1. String name = "";
  2. try {
  3. name = CRS.getAuthorityFactory(true).getDescriptionText(code).toString(getLocale());
  4. } catch (Exception e) {

相关文章