《刘航:基于PostGIS的空间数据实时编辑与拓扑检查-企业GIS专场(35页).pdf》由会员分享,可在线阅读,更多相关《刘航:基于PostGIS的空间数据实时编辑与拓扑检查-企业GIS专场(35页).pdf(35页珍藏版)》请在三个皮匠报告上搜索。
1、基于PostGIS的空间数据实时编辑与拓扑检查演讲人:刘航CONTENTS 目录01PART ONE 实时编辑实时编辑02PART TWO 空间拓扑空间拓扑03PART THREE 拓展拓展01 数据编辑与问题优化C/S数据编辑用户GIS软件SHP、GDBGeoJSONB/S数据编辑用户浏览器服务端DBDBDBSHP、GDBGeoJSON数据操作ST_SplitThe function supports splitting a line by(multi)point,(multi)line or(multi)polygon boundary,a(multi)polygon by line.Th
2、e returned geometry is always a collection.Think of this function as the opposite of ST_Union.Theoretically applying ST_Union to the elements of the returned collection should always yield the original geometry.切割前切割后ST_UnionOutput type can be a MULTI*,single geometry,or Geometry Collection.Comes in
3、 2 variants.Variant 1 unions 2 geometries resulting in a new geometry with no intersecting regions.Variant 2 is an aggregate function that takes a set of geometries and unions them into a single ST_Geometry resulting in no intersecting regions.合并前合并后成功了?存在问题:切割后合并存在短线问题优化方案:ST_Buffer(geometryg1,floa
4、tradius_of_buffer,textbuffer_style_parameters=)优化方案:ST_Snap(geometryinput,geometryreference,floattolerance)ST_BuffergeometryST_Buffer(geometryg1,floatradius_of_buffer,textbuffer_style_parameters=);geometryST_Buffer(geometryg1,floatradius_of_buffer,integernum_seg_quarter_circle);ST_BuffergeometryST_B
5、uffer(geometryg1,floatradius_of_buffer,textbuffer_style_parameters=);geometryST_Buffer(geometryg1,floatradius_of_buffer,integernum_seg_quarter_circle);ST_SnapgeometryST_Snap(geometryinput,geometryreference,floattolerance);SnapstheverticesandsegmentsofageometrytoanotherGeometrysvertices.Asnapdistance
6、toleranceisusedtocontrolwheresnappingisperformed.Theresultgeometryistheinputgeometrywiththeverticessnapped.Ifnosnappingoccursthentheinputgeometryisreturnedunchanged.Snappingonegeometrytoanothercanimproverobustnessforoverlayoperationsbyeliminatingnearly-coincidentedges(whichcauseproblemsduringnodinga
7、ndintersectioncalculation).ST_Snapgeometry ST_SnapST_Snap(geometryinput,geometryreference,floattolerance);ST_Snapgeometry ST_SnapST_Snap(geometryinput,geometryreference,floattolerance);ST_Snapgeometry ST_SnapST_Snap(geometryinput,geometryreference,floattolerance);Note:ST_Buffer与ST_Snap的阈值大小 正负值ST_Bu
8、ffer 处理后图形的有效性验证问题(ST_IsValid)02 数据拓扑与问题优化哪些拓扑问题?哪些拓扑问题?超出边界面缝隙面重叠取相交部分:St_Intersection判断是否相交:St_Intersectsboolean ST_IntersectsST_Intersects(geometrygeomA,geometrygeomB)geometry ST_IntersectionST_Intersection(geometrygeomA,geometrygeomB);SELECT ST_Intersects(POINT(0 0):geometry,LINESTRING(2 0,0 2):
9、geometry);-f SELECT ST_AsText(ST_Intersection(POINT(0 0):geometry,LINESTRING(0 0,0 2):geometry);-POINT(0 0)从A取与B不相交部分:ST_Difference取不相交部分:ST_SymDifferencegeometry ST_SymDifferenceST_SymDifference(geometrygeomA,geometrygeomB);SELECT ST_AsText(ST_SymDifference(ST_GeomFromText(LINESTRING(50 100,50 200)
10、,ST_GeomFromText(LINESTRING(50 50,50 150);st_astext-MULTILINESTRING(50 150,50 200),(50 50,50 100)geometry ST_DifferenceST_Difference(geometrygeomA,geometrygeomB);SELECT ST_AsText(ST_Difference(LINESTRING(50 100,50 200):geometry,LINESTRING(50 50,50 150):geometry);st_astext-LINESTRING(50 150,50 200)如何
11、实现?超出边界1.将内部面Union,命名为geom12.外部大面命名为geom23.ST_Difference(geom1,geom2)如何实现?面缝隙1.将内部面Union,命名为geom12.外部大面命名为geom23.ST_SymDifference(geom1,geom2)如何实现?面重叠1.St_Intersection(geom1,geom2)成功了?存在问题:拓扑检查后出现很多小面优化方案:ST_Buffer(geometryg1,floatradius_of_buffer,textbuffer_style_parameters=)优化方案:设置拓扑后出现结果的面积阈值Note
12、:正负值ST_Buffer 处理后图形的有效性验证问题(ST_IsValid,st_makeValid)相交后结果是否为面,提取对应类型的图形(ST_CollectionExtract)SRID丢失(ST_SetSrid)应用案例应用案例:第四次全国经济普查第四次全国经济普查用户:5W*4村:66W小区:90W应用案例应用案例:第四次全国体育场地调查第四次全国体育场地调查调查员用户:13W体育场地:300W场地管理单位:130W平台端用户:3000调查员定位:950W应用案例应用案例:第七次全国人口普查第七次全国人口普查03 拓展介绍ST_AsMvtST_AsMVTGeomgeometryST_AsMVTGeom(geometrygeom,box2dbounds,integerextent=4096,integerbuffer=256,booleanclip_geom=true);byteaST_AsMVT(anyelementrow,textname,integerextent,textgeom_name,textfeature_id_name);Citus、pgpool 在GIS的展望 数据量大 图形操作计算量大 数据操作中存在大量聚合?火星坐标系转换函数:https:/