本文整理汇总了Java中com.vividsolutions.jts.io.gml2.GMLWriter类的典型用法代码示例。如果您正苦于以下问题:Java GMLWriter类的具体用法?Java GMLWriter怎么用?Java GMLWriter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GMLWriter类属于com.vividsolutions.jts.io.gml2包,在下文中一共展示了GMLWriter类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: geometryToGml
import com.vividsolutions.jts.io.gml2.GMLWriter; //导入依赖的package包/类
public static ClobType geometryToGml(CommandContext ctx, GeometryType geometry,
boolean withGmlPrefix)
throws FunctionExecutionException {
Geometry jtsGeometry = getGeometry(geometry);
GMLWriter writer = new GMLWriter();
if (!withGmlPrefix) {
if (geometry.getSrid() != SRID_4326) {
if (geometry.getSrid() == GeometryType.UNKNOWN_SRID) {
throw new FunctionExecutionException(QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31161));
}
jtsGeometry = GeometryTransformUtils.transform(ctx, jtsGeometry, SRID_4326);
}
writer.setPrefix(null);
} else if (geometry.getSrid() != GeometryType.UNKNOWN_SRID) {
//TODO: should include the srsName
//writer.setSrsName(String.valueOf(geometry.getSrid()));
}
String gmlText = writer.write(jtsGeometry);
return new ClobType(new ClobImpl(gmlText));
}
开发者ID:kenweezy,项目名称:teiid,代码行数:22,代码来源:GeometryUtils.java
示例2: geoToGmlUseJtsLib
import com.vividsolutions.jts.io.gml2.GMLWriter; //导入依赖的package包/类
/**
* JTS library conversion from geometry to GML.
* @param geo base Geometry gets delegated
* @return String gml encoding of the geomoetry
*/
private static String geoToGmlUseJtsLib(final Geometry geo) {
final int srid = geo.getSRID();
final GMLWriter gmlWriter = new GMLWriter();
gmlWriter.setNamespace(false);
gmlWriter.setPrefix(null);
if (srid != -1 || srid != 0) {
gmlWriter.setSrsName("EPSG:" + geo.getSRID());
}
final String gml = gmlWriter.write(geo);
// Hack to replace a gml 2.0 deprecated element in the Polygon.
// It should tolerate this as it does other depreciated elements like <gml:coordinates>.
return gml.replace("outerBoundaryIs", "exterior");
}
开发者ID:apache,项目名称:incubator-rya,代码行数:20,代码来源:GeoWaveIndexerSfTest.java
示例3: JTSWrapper
import com.vividsolutions.jts.io.gml2.GMLWriter; //导入依赖的package包/类
private JTSWrapper() {
// use a private constructor to force call of getInstance method and forbid subclassing
wktr = new WKTReader();
wktw = new WKTWriter();
wkbr = new WKBReader();
wkbw = new WKBWriter(); // PostGIS
// wkbw = new WKBWriter(2, WKBConstants.wkbXDR); // MonetDB
gmlw = new GMLWriter();
numDecimalPlaces = (new PrecisionModel()).getMaximumSignificantDigits();
}
开发者ID:esarbanis,项目名称:strabon,代码行数:12,代码来源:JTSWrapper.java
示例4: asGml
import com.vividsolutions.jts.io.gml2.GMLWriter; //导入依赖的package包/类
public static String asGml(ValueMetaInterface metaA, Object dataA) throws KettleValueException{
if (dataA==null || !metaA.isGeometry())
return null;
GMLWriter gmlWriter = new GMLWriter();
if ((metaA.getGeometrySRS()!=null) && (metaA.getGeometrySRS().getSRID()!=-1))
gmlWriter.setSrsName("EPSG:"+metaA.getGeometrySRS().getSRID());
gmlWriter.setPrefix("gml");
return gmlWriter.write(metaA.getGeometry(dataA));
}
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:10,代码来源:ValueDataUtil.java
示例5: asKml
import com.vividsolutions.jts.io.gml2.GMLWriter; //导入依赖的package包/类
public static String asKml(ValueMetaInterface metaA, Object dataA) throws KettleValueException{
if (dataA==null || !metaA.isGeometry())
return null;
GMLWriter kmlWriter = new GMLWriter();
kmlWriter.setPrefix("kml");
return kmlWriter.write(metaA.getGeometry(dataA));
}
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:8,代码来源:ValueDataUtil.java
示例6: toGML2
import com.vividsolutions.jts.io.gml2.GMLWriter; //导入依赖的package包/类
public static String toGML2(Geometry g)
{
GMLWriter writer = new GMLWriter();
return writer.write(g);
}
开发者ID:dr-jts,项目名称:jeql,代码行数:6,代码来源:GeomFunction.java
示例7: main
import com.vividsolutions.jts.io.gml2.GMLWriter; //导入依赖的package包/类
public static void main(String[] args) throws ParseException, NoSuchAuthorityCodeException, FactoryException, IOException, SchemaException, java.text.ParseException {
String wktGeometry = "POLYGON ((-61.6866679999999974 17.0244409999999995, -61.8872220000000013 17.1052740000000014, -61.7944490000000002 17.1633299999999984, -61.6866679999999974 17.0244409999999995)) POLYGON ((-61.7291719999999984 17.6086080000000003, -61.8530579999999972 17.5830540000000006, -61.8730619999999973 17.7038879999999992, -61.7291719999999984 17.6086080000000003))";
WKTReader wktR = new WKTReader();
Geometry geom = wktR.read(wktGeometry);
// write JTS to string
GMLWriter gmlW = new GMLWriter(true);
gmlW.setSrsName("<http://www.opengis.net/def/crs/EPSG/0/4326>");
String gml = gmlW.write(geom);
System.out.println(gml);
GeometryBuilder gb = new GeometryBuilder(gml);
WKTParser wktp = new WKTParser(gb);
wktp.parse(wktGeometry);
}
开发者ID:jimjonesbr,项目名称:lod4wfs,代码行数:22,代码来源:TestGeoTools.java
注:本文中的com.vividsolutions.jts.io.gml2.GMLWriter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论