本文整理汇总了Java中org.geotools.referencing.CRS.getAuthorityFactory方法的典型用法代码示例。如果您正苦于以下问题:Java CRS.getAuthorityFactory方法的具体用法?Java CRS.getAuthorityFactory怎么用?Java CRS.getAuthorityFactory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.geotools.referencing.CRS
的用法示例。
在下文中一共展示了CRS.getAuthorityFactory方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toShapeFile
import org.geotools.referencing.CRS; //导入方法依赖的package包/类
/**
* write a shapefile representing the grid in a coordinate ref system ex :
* "EPSG:2975" -> RGR92, "EPSG:2154" -> L93, "EPSG:4326" -> WGS84
*
* @param fileName
* @param epsg
*/
public void toShapeFile(String fileName, String epsg) {
FT_FeatureCollection<IFeature> pop = new FT_FeatureCollection<>();
System.out.println("writing..." + fileName);
for (int i = 0; i < nbRows(); ++i)
for (int j = 0; j < nbCols(); ++j)
pop.add(new DefaultFeature(tiles[i][j]));
CRSAuthorityFactory factory = CRS.getAuthorityFactory(true);
CoordinateReferenceSystem crs = null;
try {
crs = factory.createCoordinateReferenceSystem(epsg);
} catch (FactoryException e) {
e.printStackTrace();
}
ShapefileWriter.write(pop, fileName, crs);
System.out.println("writing done");
}
示例2: selectCRS
import org.geotools.referencing.CRS; //导入方法依赖的package包/类
/**
* search the CRS database and return any which include the string provided.
*
* @param value
* - a string to search for.
* @return an ArrayList of CRS that match (may be empty, but not null).
*/
private ArrayList<CoordinateReferenceSystem> selectCRS(String value) {
String lValue = value.toLowerCase();
ArrayList<CoordinateReferenceSystem> ret = new ArrayList<CoordinateReferenceSystem>();
ArrayList<CoordinateReferenceSystem> possibles = listCRS();
CRSAuthorityFactory factory = CRS.getAuthorityFactory(false);
for (CoordinateReferenceSystem crs : possibles) {
if (crs.getName().getCode().toLowerCase().contains(lValue)) {
ret.add(crs);
} else if (crs.getName().getCodeSpace() != null
&& crs.getName().getCodeSpace().toLowerCase().contains(lValue)) {
ret.add(crs);
} else if (crs.getRemarks() != null
&& crs.getRemarks().toString().contains(lValue)) {
ret.add(crs);
} else if (crs.getCoordinateSystem().getRemarks() != null
&& crs.getCoordinateSystem().getRemarks().toString().toLowerCase()
.contains(lValue)) {
ret.add(crs);
}
}
return ret;
}
示例3: listDb
import org.geotools.referencing.CRS; //导入方法依赖的package包/类
/**
* ask the Authority Factory to provide a list of CRS codes and Descriptions.
*
* @return a list of strings, code\tdescription.
*/
private ArrayList<String> listDb() {
ArrayList<String> ret = new ArrayList<String>();
CRSAuthorityFactory authFac = CRS.getAuthorityFactory(false);
try {
Set<String> list = authFac
.getAuthorityCodes(CoordinateReferenceSystem.class);
for (String code : list) {
ret.add(code + "\t" + authFac.getDescriptionText(code));
}
} catch (FactoryException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return ret;
}
示例4: testInvertQueryNorthEastAxisOrder
import org.geotools.referencing.CRS; //导入方法依赖的package包/类
@Test
public void testInvertQueryNorthEastAxisOrder() throws Exception {
Filter filter = ff.bbox("geom", 0, 0, 0, 0, "EPSG:4326");
CRSAuthorityFactory factory = CRS.getAuthorityFactory(false);
CoordinateReferenceSystem crs = factory.createCoordinateReferenceSystem("EPSG:4326");
ReferencedEnvelope env = new ReferencedEnvelope(2,3,0,1,crs);
Query query = new Query();
query.setFilter(filter);
Query queryOut = process.invertQuery(env, query, null);
assertEquals(ff.bbox("geom", 0, 2, 1, 3, "EPSG:4326"), queryOut.getFilter());
}