本文将深刻剖析在Leaflet中,对于面(Polygon)和多面(MultiPolygon)在影像掩膜实战过程的正确展示方法,分析了问题产生的原因以及如何解决多面(MultiPolygon)进行影像掩膜实现 因为polygon是完全正常的,刚开始想着是否可以把MultiPolygon转为polygon,在数据层解决。这种思路是有问题的,因为MultiPolygon是有现实的空间意义的。 首先对多面转成单面,关键的核心代码如下,将多面对象传入:function multiPolygon2polygons (multiPolygon){ if(multiPolygon.type ! == 'MultiPolygon'){ return } var polygons = []; multiPolygon.coordinates.forEach((item)=>{ 本文将深刻剖析在Leaflet中,对于面(Polygon)和多面(MultiPolygon)在影像掩膜实战过程的正确展示方法,分析了问题产生的原因以及如何解决多面(MultiPolygon)进行影像掩膜实现
(((121.87476 31.63516, 121.87542 ... 9 浙江省 330000 省 Zhejiang Zhè Jiāng 330000 Province 2022 MULTIPOLYGON (((119.92414 35.62384, 119.92294 ... 14 河南省 410000 省 Henan Hé Nán 410000 Province 2022 MULTIPOLYGON (((111.02770 33.17911, 111.02767 ... 15 湖北省 420000 省 Hubei Hú Běi 420000 Province 2022 MULTIPOLYGON ( ((113.12740 29.43223, 113.11645 ... 16 湖南省 430000 省 Hunan Hú Nán 430000 Province 2022 MULTIPOLYGON (( (((109.20674 20.91898, 109.20686 ... 19 海南省 460000 省 Hainan Hǎi Nán 460000 Province 2022 MULTIPOLYGON
(117.56937 40.19153, 117.56744 40.189... 79.003211 2 河北省 130000 省 Hebei Hé Běi 130000 Province 2022 MULTIPOLYGON (121.87476 31.63516, 121.87542 ... 16.877693 9 浙江省 330000 省 Zhejiang Zhè Jiāng 330000 Province 2022 MULTIPOLYGON (((119.92414 35.62384, 119.92294 ... 82.199015 14 河南省 410000 省 Henan Hé Nán 410000 Province 2022 MULTIPOLYGON (((111.02770 33.17911, 111.02767 ... 14.491251 15 湖北省 420000 省 Hubei Hú Běi 420000 Province 2022 MULTIPOLYGON (((113.12740 29.43223, 113.11645 ... 0.626169 16 湖南省 430000 省 Hunan Hú Nán 430000 Province 2022 MULTIPOLYGON
(((121.87476 31.63516, 121.87542 ... 9 浙江省 330000 省 Zhejiang Zhè Jiāng 330000 Province 2022 MULTIPOLYGON (((119.92414 35.62384, 119.92294 ... 14 河南省 410000 省 Henan Hé Nán 410000 Province 2022 MULTIPOLYGON (((111.02770 33.17911, 111.02767 ... 15 湖北省 420000 省 Hubei Hú Běi 420000 Province 2022 MULTIPOLYGON ( ((113.12740 29.43223, 113.11645 ... 16 湖南省 430000 省 Hunan Hú Nán 430000 Province 2022 MULTIPOLYGON (( (((109.20674 20.91898, 109.20686 ... 19 海南省 460000 省 Hainan Hǎi Nán 460000 Province 2022 MULTIPOLYGON
} Feature lineFeature = new Feature(); if (feature.getGeometry() instanceof MultiPolygon ) { MultiPolygon multiPolygon = (MultiPolygon) feature.getGeometry(); LineString[] lines = new LineString[multiPolygon.getNumGeometries()]; for (int i = 0; i < multiPolygon.getNumGeometries(); i++) { Polygon polygon = (Polygon) multiPolygon.getGeometryN
3 MULTIPOLYGON (((18540813.879 3244247.734, 1853... 4 510600 德阳市 6 city 4 MULTIPOLYGON (((18516163.207 ... 2 510400 攀枝花市 5 C 2 MULTIPOLYGON (((18183734.470 2889855.327, 1818... 3 510500 泸州市 7 C 3 MULTIPOLYGON MULTIPOLYGON (((112.07982 30.65932, 112.08643 ... 4 420600 襄阳市 9 city 4 MULTIPOLYGON (((111.58304 32.59654 ... 420700 鄂州市 city 5 5 MULTIPOLYGON (((112.06071 30.68840, 112.06988 ... 420800 荆门市 city 6 6 MULTIPOLYGON .. 421000.0 8.0 5 MULTIPOLYGON (((112.06071 30.68840, 112.06988 ... 420800.0 6.0 6 MULTIPOLYGON (((114.94866
)', 4326)), 0) multi FROM dual;MULTI----------------------------------------------------------------MULTIPOLYGON -----------------MULTILINESTRING ((0 0, 1 1), (2 2, 4 4))SELECT st_astext(st_multi(st_geomfromText('multipolygon )', 4326)), 0) multi FROM dual;MULTI----------------------------------------------------------------MULTIPOLYGON
] } } ] } geojson将所有的地理要素分为Point、MultiPoint、LineString、MultiLineString、Polygon、MultiPolygon 106.10595703125,33.33970700424026] ] ] } } 多多边形MultiPolygon type 1 两个不会相交的多边形 { "type": "Feature", "properties": {}, "geometry": { "type": "MultiPolygon", 个中括号,但效果不是有洞的 { "type": "Feature", "properties": {}, "geometry": { "type": "MultiPolygon type 3 有孔洞的多边形 { "type": "Feature", "properties": {}, "geometry": { "type": "MultiPolygon
) 多点 MULTIPOINT(44 4,11 44,33 25) 多线 MULTILINESTRING((3 4,10 50,20 25),(-5 -8,-10 -8,-15 -4)) 多面 MULTIPOLYGON MultiLineString","coordinates":[[[3, 4],[10, 50],[20, 25]],[[-5, -8],[-10, -8],[-15, -4]]} 多面 {"type":"MultiPolygon 4,6]},},{"type":"Feature","geometry":{"type":"LineString","coordinates":[[[4,6],[7,10]]}]} 具体需求 目前MULTIPOLYGON String type = geom.getGeometryType(); jsonObject.put("type", geom.getGeometryType()); if ("MultiPolygon 例如(COUNT,MAX函数等) 表生成UDF(UDTF) 接受一个数据行,然后返回产生多个数据行(一个表作为输出) 这里的需求是MULTIPOLYGON拆成POLYGON所以需要实现UDTF
db.mongo_rect.insert({ "type": "Feature", "properties": { "name": "tect1", "code": "rect1" }, "geometry": { "type": "MultiPolygon db.mongo_rect.insert({ "type": "Feature", "properties": { "name": "rect2", "code": "rect2" }, "geometry": { "type": "MultiPolygon db.mongo_rect.insert({ "type": "Feature", "properties": { "name": "rect3", "code": "rect3" }, "geometry": { "type": "MultiPolygon db.mongo_rect.insert({ "type": "Feature", "properties": { "name": "tect1", "code": "rect1" }, "geometry": { "type": "MultiPolygon
Spatial Data Type)对应于OpenGIS类,包括单值类型:GEOMETRY、POINT、LINESTRING、POLYGON以及集合类型:MULTIPOINT、MULTILINESTRING、MULTIPOLYGON 下面展示几种常见的几何图形元素: [在这里插入图片描述] MultiPoint、MultiLineString、MultiPolygon、GeometryCollection 这4种类型都是集合类,是多个
"fillColor": "grey" }, "geometry": { "type": "MultiPolygon "fillColor": "#444" }, "geometry": { "type": "MultiPolygon
GeoJSON支持如下几何类型: Point 点 LineString 线段 Polygon 多边形 MultiPoint 多个点 MultiLineString 多个线段 MultiPolygon 多个多边形 零维的Point和MultiPoint; 一维的曲线 LineString和MultiLineString;二维的曲面Polygon和MultiPolygon;和异构的GeometryCollection MultiPolygon 对于类型”MultiPolygon“, ”coordinates“成员是一个Polygon的坐标数组。 3.1.8. { "type": "MultiPolygon", "coordinates": [ [ [ [180.0, 40.0], [180.0, 50.0], [170.0, 50.0] MultiPolygons MultiPolygon的坐标是一个Polygon坐标数组的数组: { "type": "MultiPolygon", "coordinates": [ [ [
3,3 2,2 2)) MULTIPOINT(3.5 5.6, 4.8 10.5) MULTILINESTRING((3 4,10 50,20 25),(-5 -8,-10 -8,-15 -4)) MULTIPOLYGON GEOMETRYCOLLECTION(POINT(4 6),LINESTRING(4 6,7 10)) POINT ZM (1 1 5 60) POINT M (1 1 80) POINT EMPTY MULTIPOLYGON
[经度1,纬度1] ] ] } } 多多边形要素(MultiPolygon 对应的GeoJSON数据如下: { "type": "Feature", "properties": {}, "geometry": { "type": "MultiPolygon", 对应的GeoJSON数据如下: { "type": "Feature", "properties": {}, "geometry": { "type": "MultiPolygon" [104.2822265625,30.107117887092357] ] ] ] } } 有孔的多边形: 有孔的多边形在类别上也是归类到MultiPolygon 可以看出其与多个重叠的多边形的区别在于多边形矢量信息嵌套在第二层列表中: { "type": "Feature", "properties": {}, "geometry": { "type": "MultiPolygon
如输入的geometry是POLYGON、MULTIPOLYGON类型,缩小到一定程度之后会返回POLYGON EMPTY或MULTIPOLYGON EMPTY。
LINESTRING: 'LineString', MULTILINESTRING: 'MultiLineString', POLYGON: 'Polygon', MULTIPOLYGON : 'MultiPolygon' } class Feature { constructor(geomType, properties, geometry) {
地图扩展组件改进 我们为地图扩展组件添加了新的重要功能:能够显示 MultiPoint、MultiLine 和 MultiPolygon 几何图形、热图图层和聚类图。 MultiPolygon 是单一几何图形多边形的集合。 在下面的示例中,我们创建了一个由两个矩形组成的 MultiPolygon: private void addMultiPolygon(VectorSource vectorSource) { multiPolygon = factory.createMultiPolygon(new Polygon[]{polygon1, polygon2}); vectorSource.addFeature (new MultiPolygonFeature(multiPolygon)); } 地图中显示如下: ▲地图中的多边形 聚类功能支持通过合并功能在地图上显示大量标记。
com.vividsolutions.jts.geom.MultiLineString; import com.vividsolutions.jts.geom.MultiPoint; import com.vividsolutions.jts.geom.MultiPolygon : geoType = MultiLineString.class; case "Polygon": geoType = Polygon.class; case "MultiPolygon ": geoType = MultiPolygon.class; } //创建shape文件对象 File file = new File(shpPath); Map<
对应的在geometry 数据类型中也是这3种类型Point、LineString、Polygon以及各自的集合MultiPoint、MultiLineString、MultiPolygon 另外还有一个它们的混合的集合 很容易看出MultiPoint、MultiLineString、MultiPolygon是GeometryCollection的一种特殊情况。 定义一个带孔的多边形 MultiPoint((1 2),(1 3),(1 4))定义了3个点的点集合 MultiLineString((1 2,1 3),(1 4,2 4, 4 4))定义了2条线的线集合 MultiPolygon