Question

Remove duplicate features and preserve specific ones

  • 7 August 2015
  • 4 replies
  • 4 views

Greetings people,

 

 

I need to fill three tables in SQL Server Non-Spatial. Tables are point, line and polygon. I read data from GML. Now, I need to insert all points, points from lines and from polygons, lines and lines from polygons and polygons, but they must fill some condition. All of them have attribute LAYER and GEOMETRY (WKB format). I need to write just these who has minimal value of LAYER (integer) and with distinct GEOMETRY. This minimal value of LAYER is minimal for each group of features with same GEOMETRY. This rule is same for all feature types.

E.g. I have

WKB1, 1

WKB1, 2

WKB2, 2

and only need to write the last two.

Can someone give me an idea? I hope you know what I asked. :D


4 replies

Userlevel 2
Badge +17
Sort the features by LAYER ascending, and remove duplicate from each GEOMETRY group by the DuplicateRemover.

 

 

But not sure... why the last two for your example?

 

-----

 

WKB1, 1

 

WKB1, 2

 

WKB2, 2

 

-----

 

If the second column means LAYER, the first feature has minimal value for WKB1 group?

 

 

Takashi

Takashi, very sorry, my mistake. First and last feature, not second one.

I have problem with point order in lines. When I break polygons to lines, it creates (almost allways) two lines with reverse point order for two neighbor polygons (e.g. line (1 1, 2 2) and line (2 2, 1 1)). I don't know how to solve this.

One more problem that appears: I already have table with lines. How to select which features to insert and which to update (based on same criteria).

Userlevel 2
Badge +17
If you send the polygons to the TopologyBuilder (Group By: LAYER), duplicated lines will not be created.

 

Regarding the second problem, the ChangeDetector might help you.
I tried TopologyBuilder for lines and points. It seems that it duplicates points. For lines Im not sure, but Im suspicious.

Reply