本文整理汇总了Java中org.pentaho.di.core.row.ValueMetaInterface.setGeometrySRS方法的典型用法代码示例。如果您正苦于以下问题:Java ValueMetaInterface.setGeometrySRS方法的具体用法?Java ValueMetaInterface.setGeometrySRS怎么用?Java ValueMetaInterface.setGeometrySRS使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pentaho.di.core.row.ValueMetaInterface
的用法示例。
在下文中一共展示了ValueMetaInterface.setGeometrySRS方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertToJTSGeometry
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
public Geometry convertToJTSGeometry(ValueMetaInterface vmi, Object obj, Database db) {
if (obj instanceof oracle.sql.STRUCT) {
try {
// Map Oracle's SRID with the EPSG-SRID or take a custom SRS from WKT
int oracle_srid = JGeometry.load((STRUCT)obj).getSRID();
// see bug 2845785; disabled reading of SRS metadata as temporary workaround,
// meanwhile one must assign SRS manually using Set SRS step
// TODO: review everything!
// SRS epsg_srid = convertToEPSG_SRID(oracle_srid, db.getConnection());
SRS epsg_srid = SRS.UNKNOWN;
vmi.setGeometrySRS(epsg_srid);
WKB wkb = new WKB(ByteOrder.BIG_ENDIAN); // Create empty WKB representation
byte[] b = wkb.fromSTRUCT( (STRUCT) obj ); // convert: Object -> STRUCT -> byte[]
Geometry jtsGeom = (new WKBReader()).read(b); // convert: byte[] -> JTS-Geometry
jtsGeom.setSRID(epsg_srid.getSRID()); // set the SRID of the JTS-Geometry
return jtsGeom;
} catch (Exception e) {
LOGGER.logError("GeoKettle", "Conversion from Oracle-geometry failed.");
return null;
}
} else {
LOGGER.logDetailed("GeoKettle", "No Oracle-geometry found to convert.");
return null;
}
}
示例2: getFields
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
public void getFields(RowMetaInterface inputRowMeta, String name,
RowMetaInterface info[], StepMeta nextStep, VariableSpace space)
throws KettleStepException {
// Set the SRS in ValueMeta, if it has changed or leave everything at is
// is, if there are no changes to make.
if (!selectedSRS.equals(SRS.UNKNOWN) && !Const.isEmpty(fieldName)) {
int idx = inputRowMeta.indexOfValue(fieldName);
// Value found
if (idx >= 0) {
// This is the value we need to change:
ValueMetaInterface v = inputRowMeta.getValueMeta(idx);
// Do we need to set the SRID?
// if (v.getGeometrySRS().equals(SRS.UNKNOWN)) {
v.setGeometrySRS(selectedSRS);
v.setOrigin(name);
// }
}
}
}
示例3: getFields
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
public void getFields(RowMetaInterface inputRowMeta, String name,
RowMetaInterface info[], StepMeta nextStep, VariableSpace space)
throws KettleStepException {
// Set the SRS in ValueMeta, if it has changed or leave everything at is
// is, if there are no changes to make.
if (!targetSRS.equals(SRS.UNKNOWN) && !Const.isEmpty(fieldName)) {
int idx = inputRowMeta.indexOfValue(fieldName);
// Value found
if (idx >= 0) {
// This is the value we need to change:
ValueMetaInterface v = inputRowMeta.getValueMeta(idx);
// Do we need to set the SRID?
// if (v.getGeometrySRS().equals(SRS.UNKNOWN)) {
v.setGeometrySRS(targetSRS);
v.setOrigin(name);
// }
}
}
}
示例4: convertToJTSGeometry
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
public Geometry convertToJTSGeometry(ValueMetaInterface vmi, Object o, Database db) {
if (o instanceof byte[]) {
try {
// treat the values read from MySQL as byte stream
InputStream inStream = new ByteArrayInputStream( (byte[]) o );
if (inStream == null) {
throw new IOException("Could not read from byte array!");
}
// read first 4 bytes that represent the SRID
byte[] sridFromByteArray = new byte[4];
inStream.read(sridFromByteArray);
// Map MySQL's SRID with the EPSG-SRID or take a custom SRS from WKT
int mysql_srid = ByteOrderValues.getInt(sridFromByteArray, ByteOrderValues.LITTLE_ENDIAN);
SRS epsg_srid = convertToEPSG_SRID(mysql_srid, db.getConnection());
vmi.setGeometrySRS(epsg_srid);
// parse the rest of the byte array as WKB and convert to Geometry
Geometry geom = new WKBReader().read( new InputStreamInStream(inStream) );
geom.setSRID(epsg_srid.getSRID());
return geom;
} catch (Exception e) {
LOGGER.logError("GeoKettle", "Conversion from MySQL-geometry failed.");
return null;
}
} else {
LOGGER.logDetailed("GeoKettle", "No MySQL-geometry found to convert");
return null;
}
}