SimpleFeature与SimpleFeatureType
创始人
2024-03-23 15:33:50

 SimpleFeature要应用之前需要先设置schema(字段定义)SimpleFeatureType,然后用定义好的字段SimpleFeatureType对象作为参数
        构建SimpleFeature然后对字段赋值
        
          //设置scheme
        SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder();
        b.setName("poiTable");
        b.setCRS(DefaultGeographicCRS.WGS84);
        b.add("name", String.class);
        b.add("location", Point.class);

        SimpleFeatureType typeScheme = b.buildFeatureType();
             
               SimpleFeatureBuilder featureBuilder  = new SimpleFeatureBuilder( typeScheme );

        //存储数据
        Point point = geometryFactory.createPoint(new Coordinate(116.39622 ,40.027074));
        featureBuilder.set("location", point);
        featureBuilder.set("name", "五台山");

        //生成对象
        SimpleFeature simpleFeature = featureBuilder.buildFeature("010101");


        //对象使用
        Point point1 = (Point)simpleFeature.getAttribute("location");

相关内容

热门资讯

哥伦比亚外交部向美发出抗议照会 转自:北京日报客户端哥伦比亚外交部6日在首都波哥大召开新闻发布会宣布,哥方当天将与美国驻哥大使馆临时...
道指、标普500指数均创收盘历... 转自:证券时报人民财讯1月7日电,美股三大指数集体收涨,道指、标普500指数均创收盘历史新高,其中,...
重庆合川:盘活资产做强产业 日前,记者来到重庆云起汽车系统有限公司合川生产基地,先进、宽敞的厂房内,技术人员正抓紧调试设备。“作...
音频 | 格隆汇1.7盘前要点... 格隆汇1月7日|国际要闻:1、道指、标普500指数均创新高,美光涨超10%,中概指数跌0.78%;2...
去年集中窃取机密数据,行动当天... 来源:环球【环球时报报道 记者 郭媛丹】近日,美国对委内瑞拉实施军事打击并强抓委内瑞拉总统马杜罗夫妇...