| | |
| | | String geomProperty = "the_geom"; |
| | | String idProperty = "ID"; |
| | | String nameProperty = "name"; |
| | | String firmIdProperty = "firmId"; |
| | | String firmNameProperty = "firmName"; |
| | | |
| | | //设置图形类型 |
| | | if ("Polygon".equals(geomType)) { |
| | |
| | | //设置对应属性类型 |
| | | tb.add(idProperty, String.class); |
| | | tb.add(nameProperty, String.class); |
| | | tb.add(firmIdProperty, String.class); |
| | | tb.add(firmNameProperty, String.class); |
| | | |
| | | //设置默认geometry |
| | | tb.setDefaultGeometry(geomProperty); |
| | |
| | | for (Map<String, Object> map : dataPropertiesList) { |
| | | feature = writer.next(); |
| | | //属性赋值 geometry要赋值wkt格式的 |
| | | feature.setAttribute(geomProperty, new WKTReader().read((MapUtil.getStr(map, "geometry")))); |
| | | if (map.containsKey("geometry")) { |
| | | feature.setAttribute(geomProperty, new WKTReader().read((MapUtil.getStr(map, "geometry")))); |
| | | } |
| | | feature.setAttribute(idProperty, MapUtil.getStr(map, idProperty)); |
| | | feature.setAttribute(nameProperty, MapUtil.getStr(map, nameProperty)); |
| | | feature.setAttribute(firmIdProperty, MapUtil.getStr(map, firmIdProperty)); |
| | | feature.setAttribute(firmNameProperty, MapUtil.getStr(map, firmNameProperty)); |
| | | // String description = MapUtil.getStr(map, "描述"); |
| | | // if (CharSequenceUtil.isNotBlank(description)) { |
| | | // feature.setAttribute(descriptionProperty, description); |