本文整理匯總了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());
}