[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgis-users
Subject:    [postgis-users] removing objects and at the same time updating others
From:       <paul.malm () lfv ! se>
Date:       2020-06-23 6:07:14
Message-ID: b0c8bc31c761494da5e331bde04c530c () lfv ! se
[Download RAW message or body]

Hi list,
I have a problem with adjacent polygons when converting them to lines,
as I would like to only have one line in the boundaries between the former polygons. \
Now it could be up to 5. I've been thinking of:

1.       Creating a thin buffer around the line strings with the featureId from the \
line strings as a new layer.

2.       Then I should break the line strings to line segments into a new layer with \
where the line segments gets the featureId from the line string.

3.       Create a column (edited) in the new line-segment layer with a default value \
of 0

4.       Then delete from the line segments layer all segments that are within the \
buffer, but not the line segments that have the same featureId as the current buffer \
and edited value must be 0 to be deleted.

5.       The line segments that are not deleted in the current buffer shall be \
updated (edited = 1).

6.       Do step 4 and 5 until the all objects in the buffered layer is executed.
I've come this far:
DELETE FROM "LineSegments" USING buffered as h WHERE
ST_Contains(h.the_geom, " LineSegments".the_geom) AND
"LineSegments".edited = 0 AND
NOT h.fid=" LineSegments".fid;

But how can I set the edited vale = 1 on the objects (line segments) that are not \
deleted (in the current buffer) at the same time so it won't be deleted in the next \
run with an adjacent buffer? Kind regards,
Paul


[Attachment #3 (text/html)]

<html xmlns:v="urn:schemas-microsoft-com:vml" \
xmlns:o="urn:schemas-microsoft-com:office:office" \
xmlns:w="urn:schemas-microsoft-com:office:word" \
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" \
xmlns="http://www.w3.org/TR/REC-html40"> <head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:Tahoma;
	panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
	{font-family:Consolas;
	panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";
	mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:purple;
	text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
	{mso-style-priority:99;
	mso-style-link:"Ballongtext Char";
	margin:0cm;
	margin-bottom:.0001pt;
	font-size:8.0pt;
	font-family:"Tahoma","sans-serif";
	mso-fareast-language:EN-US;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
	{mso-style-priority:34;
	margin-top:0cm;
	margin-right:0cm;
	margin-bottom:0cm;
	margin-left:36.0pt;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";
	mso-fareast-language:EN-US;}
span.E-postmall17
	{mso-style-type:personal-compose;
	font-family:"Calibri","sans-serif";
	color:windowtext;}
span.BallongtextChar
	{mso-style-name:"Ballongtext Char";
	mso-style-priority:99;
	mso-style-link:Ballongtext;
	font-family:"Tahoma","sans-serif";}
.MsoChpDefault
	{mso-style-type:export-only;
	font-family:"Calibri","sans-serif";
	mso-fareast-language:EN-US;}
@page WordSection1
	{size:612.0pt 792.0pt;
	margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
	{page:WordSection1;}
/* List Definitions */
@list l0
	{mso-list-id:1024555881;
	mso-list-type:hybrid;
	mso-list-template-ids:547898540 69009423 69009433 69009435 69009423 69009433 \
69009435 69009423 69009433 69009435;} @list l0:level1
	{mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l0:level2
	{mso-level-number-format:alpha-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l0:level3
	{mso-level-number-format:roman-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:right;
	text-indent:-9.0pt;}
@list l0:level4
	{mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l0:level5
	{mso-level-number-format:alpha-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l0:level6
	{mso-level-number-format:roman-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:right;
	text-indent:-9.0pt;}
@list l0:level7
	{mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l0:level8
	{mso-level-number-format:alpha-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l0:level9
	{mso-level-number-format:roman-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:right;
	text-indent:-9.0pt;}
ol
	{margin-bottom:0cm;}
ul
	{margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="SV" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">Hi list,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I have a problem with adjacent polygons when \
converting them to lines,<o:p></o:p></span></p> <p class="MsoNormal"><span \
lang="EN-US">as I would like to only have one line in the boundaries between the \
former polygons. Now it could be up to 5.<o:p></o:p></span></p> <p \
class="MsoNormal"><span lang="EN-US">I&#8217;ve been thinking \
of:<o:p></o:p></span></p> <p class="MsoListParagraph" \
style="text-indent:-18.0pt;mso-list:l0 level1 lfo1"><![if !supportLists]><span \
lang="EN-US"><span style="mso-list:Ignore">1.<span style="font:7.0pt &quot;Times New \
Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
</span></span></span><![endif]><span lang="EN-US">Creating a thin buffer around the \
line strings with the featureId from the line strings as a new \
layer.<o:p></o:p></span></p> <p class="MsoListParagraph" \
style="text-indent:-18.0pt;mso-list:l0 level1 lfo1"><![if !supportLists]><span \
lang="EN-US"><span style="mso-list:Ignore">2.<span style="font:7.0pt &quot;Times New \
Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
</span></span></span><![endif]><span lang="EN-US">Then I should break the line \
strings to line segments into a new layer with where the line segments gets the \
featureId from the line string.<o:p></o:p></span></p> <p class="MsoListParagraph" \
style="text-indent:-18.0pt;mso-list:l0 level1 lfo1"><![if !supportLists]><span \
lang="EN-US"><span style="mso-list:Ignore">3.<span style="font:7.0pt &quot;Times New \
Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
</span></span></span><![endif]><span lang="EN-US">Create a column (edited) in the new \
line-segment layer with a default value of 0<o:p></o:p></span></p> <p \
class="MsoListParagraph" style="text-indent:-18.0pt;mso-list:l0 level1 lfo1"><![if \
!supportLists]><span lang="EN-US"><span style="mso-list:Ignore">4.<span \
style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
</span></span></span><![endif]><span lang="EN-US">Then delete from the line segments \
layer all segments that are within the buffer, but not the line segments that have \
the same featureId as the current buffer and edited value must be 0 to be \
deleted.<o:p></o:p></span></p> <p class="MsoListParagraph" \
style="text-indent:-18.0pt;mso-list:l0 level1 lfo1"><![if !supportLists]><span \
lang="EN-US"><span style="mso-list:Ignore">5.<span style="font:7.0pt &quot;Times New \
Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
</span></span></span><![endif]><span lang="EN-US">The line segments that are not \
deleted in the current buffer shall be updated (edited = 1).<o:p></o:p></span></p> <p \
class="MsoListParagraph" style="text-indent:-18.0pt;mso-list:l0 level1 lfo1"><![if \
!supportLists]><span lang="EN-US"><span style="mso-list:Ignore">6.<span \
style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
</span></span></span><![endif]><span lang="EN-US">Do step 4 and 5 until the all \
objects in the buffered layer is executed.<o:p></o:p></span></p> <p \
class="MsoNormal"><span lang="EN-US"><o:p></o:p></span></p> <p \
class="MsoNormal"><span lang="EN-US">I&#8217;ve come this far:<o:p></o:p></span></p> \
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" \
style="color:black">DELETE FROM &quot;LineSegments&quot; USING buffered as h \
WHERE</span><span lang="EN-US"><o:p></o:p></span></p> <p class="MsoNormal" \
style="text-autospace:none"><span lang="EN-US" \
style="color:black">ST_Contains(h.the_geom, &quot; LineSegments&quot;.the_geom) \
AND</span><span lang="EN-US"><o:p></o:p></span></p> <p class="MsoNormal" \
style="text-autospace:none"><span lang="EN-US" \
style="color:black">&quot;LineSegments&quot;.edited = 0 AND </span><span \
lang="EN-US"><o:p></o:p></span></p> <p class="MsoNormal"><span lang="EN-US" \
style="color:black">NOT h.fid=&quot;</span><span lang="EN-US"> </span><span \
lang="EN-US" style="color:black">LineSegments&quot;.fid;</span><span \
lang="EN-US"><o:p></o:p></span></p> <p class="MsoNormal"><span \
lang="EN-US"><o:p>&nbsp;</o:p></span></p> <p class="MsoNormal"><span lang="EN-US" \
style="mso-fareast-language:SV">But how can I set the edited vale = 1 on the objects \
(line segments) that are not deleted (in the current buffer) at the same time so it \
won&#8217;t be deleted in the next run with an adjacent  \
buffer?<o:p></o:p></span></p> <p class="MsoNormal"><span lang="EN-US" \
style="mso-fareast-language:SV">Kind regards, <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" \
style="mso-fareast-language:SV">Paul<o:p></o:p></span></p> <p class="MsoNormal"><span \
lang="EN-US" style="font-size:9.0pt;mso-fareast-language:SV"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
</div>
</body>
</html>


[Attachment #4 (unknown)]

_______________________________________________
postgis-users mailing list
postgis-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/postgis-users

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic