• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java GMLConfiguration类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.geotools.gml3.GMLConfiguration的典型用法代码示例。如果您正苦于以下问题:Java GMLConfiguration类的具体用法?Java GMLConfiguration怎么用?Java GMLConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



GMLConfiguration类属于org.geotools.gml3包,在下文中一共展示了GMLConfiguration类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: parseGML3

import org.geotools.gml3.GMLConfiguration; //导入依赖的package包/类
/**
 * Parses GML3 without specifying a schema location.
 */
public static void parseGML3() throws Exception {
    InputStream in = GMLParsing.class.getResourceAsStream( "states.xml");
    GMLConfiguration gml = new GMLConfiguration();
    Parser parser = new Parser(gml);
    parser.setStrict(false);
    
    FeatureCollection features = (FeatureCollection) parser.parse(in);
    FeatureIterator i = features.features();
    
    int nfeatures = 0;
    while( i.hasNext() ) {
        SimpleFeature f = (SimpleFeature) i.next();
        System.out.println(f.getID());
        nfeatures++;
    }
    
    System.out.println("Number of features: " + nfeatures);
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:22,代码来源:GMLParsing.java


示例2: schemaParseGML3

import org.geotools.gml3.GMLConfiguration; //导入依赖的package包/类
/**
 * Parses GML3 by specifying the schema location.
 * <p>
 * This example first transforms the original file states.xml, and sets its
 * schemaLocation to the states.xsd file.
 * </p>
 */
public static void schemaParseGML3() throws Exception {
    File xml = setSchemaLocation();
    InputStream in = new FileInputStream(xml);
    
    GMLConfiguration gml = new GMLConfiguration();
    Parser parser = new Parser(gml);
    parser.setStrict(false);
    
    FeatureCollection features = (FeatureCollection) parser.parse(in);
    FeatureIterator i = features.features();
    
    int nfeatures = 0;
    while( i.hasNext() ) {
        SimpleFeature f = (SimpleFeature) i.next();
        System.out.println(f.getID());
        nfeatures++;
    }
    
    System.out.println("Number of features: " + nfeatures);
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:28,代码来源:GMLParsing.java


示例3: withWaldbrueckeAndManual

import org.geotools.gml3.GMLConfiguration; //导入依赖的package包/类
private static void withWaldbrueckeAndManual(String folder) throws Exception {
  	URL schemaURL = new File("/Users/markus/Documents/Projects/EMFFrag/02_workspace/citygml.git/de.hub.citygml.models/schemas/CityGML_1.0.0_080815/CityGML/building.xsd").toURL();    	
  	URL modelURL = new File("/Users/markus/Documents/Projects/EMFFrag/02_workspace/citygml.git/de.hub.citygml.models/examples/fwaldbruecke/waldbruecke_small.citygml").toURL();
  	
  	//create the parser with the gml 3.0 configuration
  	org.geotools.xml.Configuration configuration = new org.geotools.gml3.GMLConfiguration();
  	org.geotools.xml.Parser parser = new org.geotools.xml.Parser( configuration );

// parse
SimpleFeatureCollection fc = (SimpleFeatureCollection) parser.parse(modelURL.openStream());
System.out.println("#3: " + fc.size());
fc.accepts(new AbstractFeatureVisitor() {
	public void visit(Feature feature) {
		SimpleFeature simpleFeature = ((SimpleFeature)feature);
		System.out.println("#3: " + feature.getType().getName());
		System.out.println("#3: " + simpleFeature.getDefaultGeometry());
	}
}, new NullProgressListener());
  }
 
开发者ID:markus1978,项目名称:citygml4emf,代码行数:20,代码来源:Quickstart.java


示例4: streamParseGML3

import org.geotools.gml3.GMLConfiguration; //导入依赖的package包/类
/**
 * Parses GML3 without specifying a schema location, and illusrates the use
 * of the streaming parser.
 */
public static void streamParseGML3() throws Exception {
    InputStream in = GMLParsing.class.getResourceAsStream( "states.xml");
    GMLConfiguration gml = new GMLConfiguration();
    StreamingParser parser = new StreamingParser( gml, in, SimpleFeature.class );
    
    int nfeatures = 0;
    SimpleFeature f = null;
    while( ( f = (SimpleFeature) parser.parse() ) != null ) {
        nfeatures++;
        System.out.println(f.getID());
    }
    
    System.out.println("Number of features: " + nfeatures);
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:19,代码来源:GMLParsing.java


示例5: withTestModelsAndManual

import org.geotools.gml3.GMLConfiguration; //导入依赖的package包/类
private static void withTestModelsAndManual(String folder) throws Exception {
	URL modelURL = new File("/Users/markus/Documents/Projects/EMFFrag/02_workspace/citygml.git/de.hub.citygml.models/schemas/"+folder+"/TestFeature.xml").toURL();
	//create the parser with the gml 3.0 configuration
	org.geotools.xml.Configuration configuration = new org.geotools.gml3.GMLConfiguration();
	org.geotools.xml.Parser parser = new org.geotools.xml.Parser( configuration );

	//parse
	SimpleFeatureCollection fc = (SimpleFeatureCollection) parser.parse(modelURL.openStream());
	System.out.println("#3: " + fc.size());
	fc.accepts( new AbstractFeatureVisitor() {
	      public void visit(Feature feature ) {
	    	  System.out.println("#3: " + feature.getType().getName());
	      }
	  }, new NullProgressListener());
}
 
开发者ID:markus1978,项目名称:citygml4emf,代码行数:16,代码来源:Quickstart.java


示例6: writeToStream

import org.geotools.gml3.GMLConfiguration; //导入依赖的package包/类
public void writeToStream(FeatureCollection<?,?> coll, OutputStream os) {
        FeatureCollection<?, ?> fc = coll;

        FeatureCollection<?, ?> correctFeatureCollection = createCorrectFeatureCollection(fc);
        //get the namespace from the features to pass into the encoder
        FeatureType schema = correctFeatureCollection.getSchema();
        String namespace = null;
        String schemaLocation = null;
        if (schema != null) {
            namespace = schema.getName().getNamespaceURI();
            schemaLocation = SchemaRepository.getSchemaLocation(namespace);
        }

        Configuration configuration = null;
        org.geotools.xml.Encoder encoder = null;
        if (schemaLocation == null || namespace == null) {
            namespace = "http://www.opengis.net/gml";
            schemaLocation = "http://schemas.opengis.net/gml/3.1.1/base/feature.xsd";
            configuration = new ApplicationSchemaConfiguration(namespace, schemaLocation);
//new GMLConfiguration();//new
            if (srsSyntax != null) {
                ((GMLConfiguration) configuration).setSrsSyntax(srsSyntax);
            }

            encoder = new org.geotools.xml.Encoder(configuration);
            encoder.setNamespaceAware(true);
            encoder.setSchemaLocation("http://www.opengis.net/gml", "http://schemas.opengis.net/gml/3.1.1/base/feature.xsd");

        } else {

            configuration = new ApplicationSchemaConfiguration(namespace, schemaLocation);
            if (srsSyntax != null) {
                ((org.geotools.gml3.ApplicationSchemaConfiguration) configuration).getDependency(org.geotools.gml3.GMLConfiguration.class).setSrsSyntax(srsSyntax);
            }
            encoder = new org.geotools.xml.Encoder(configuration);
            encoder.setNamespaceAware(true);
            encoder.setSchemaLocation("http://www.opengis.net/gml http://schemas.opengis.net/gml/3.1.1/base/feature.xsd", namespace + " " + schemaLocation);

        }

        fc.features().close();
        //use the gml namespace with the FeatureCollection element to start parsing the collection
        QName ns = new QName("http://www.opengis.net/gml", "FeatureCollection", "wfs");
        try {
            encoder.encode(correctFeatureCollection, ns, os);
        } catch (IOException e) {
            LOGGER.error("Exception while trying to encode FeatureCollection.", e);
            throw new RuntimeException(e);
        }

    }
 
开发者ID:52North,项目名称:javaps-geotools-backend,代码行数:52,代码来源:GML3BasicGenerator.java


示例7: parse

import org.geotools.gml3.GMLConfiguration; //导入依赖的package包/类
@Override
public Geometry parse(Reader reader) throws IOException, SAXException, ParserConfigurationException {
	final org.geotools.xml.Parser gmlParser = new org.geotools.xml.Parser(new GMLConfiguration()); 
	return (Geometry) gmlParser.parse(reader);
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:6,代码来源:GmlParser.java


示例8: ComplexConfiguration

import org.geotools.gml3.GMLConfiguration; //导入依赖的package包/类
public ComplexConfiguration(String namespace, String schemaLocation) {
    super(new ResolvingApplicationSchemaXSD(namespace, schemaLocation));
    addDependency(new XSConfiguration());
    addDependency(new GMLConfiguration());
}
 
开发者ID:xandris,项目名称:geoserver-sync,代码行数:6,代码来源:ComplexConfiguration.java


示例9: GMLWriter

import org.geotools.gml3.GMLConfiguration; //导入依赖的package包/类
public GMLWriter(){
	configuration = new GMLConfiguration();
	configuration.getProperties().add(GMLConfiguration.NO_FEATURE_BOUNDS);
	ns = new QName("http://www.opengis.net/gml","FeatureCollection","gml");
}
 
开发者ID:Canadensys,项目名称:narwhal-api,代码行数:6,代码来源:GMLWriter.java



注:本文中的org.geotools.gml3.GMLConfiguration类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IContext类代码示例发布时间:2022-05-22
下一篇:
Java WampClient类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap