# How to get the id of points after append filter?

**URL:** <https://discourse.vtk.org/t/how-to-get-the-id-of-points-after-append-filter/15050>\
**Category:** Development\
**Created:** [December 20, 2024, 6:09am UTC](https://discourse.vtk.org/t/how-to-get-the-id-of-points-after-append-filter/15050 "2024-12-20T06:09:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Northern\_Condor1](https://discourse.vtk.org/user_avatar/discourse.vtk.org/northern_condor1/32/9062_2.png) [@Northern\_Condor1](https://discourse.vtk.org/u/Northern_Condor1)\
**Post date:** [December 20, 2024, 6:09am UTC](https://discourse.vtk.org/t/how-to-get-the-id-of-points-after-append-filter/15050/1 "2024-12-20T06:09:15Z")

</div>

Hello!

I have dataset of composite type, and in order to use my algorithms which work wih Unordered grid, I use vtkAppendFilter. However, I also need some points ids which are stored in scalar in each of the datasets, and are present in appended dataset also, but I dont know how to map these old IDs to the new dataset

Help me very please, I ve spent many days and still have not found out how to do this

Thanks!

---

<div class="post-metadata">

**Author:** ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)\
**Post date:** [December 20, 2024, 10:22pm UTC](https://discourse.vtk.org/t/how-to-get-the-id-of-points-after-append-filter/15050/2 "2024-12-20T22:22:11Z")

</div>

Hello,

> [@Northern\_Condor1](#):
>
> I dont know how to map these old IDs to the new dataset

If I understood it right, you can’t. Those IDs are actually indexes like an array’s indexes. Normally, you can only access the original dataset IDs by previously storing them a scalar field like you did and query the original ID values later.

best,

PC

---

<div class="post-metadata">

**Author:** ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)\
**Post date:** [December 23, 2024, 3:32pm UTC](https://discourse.vtk.org/t/how-to-get-the-id-of-points-after-append-filter/15050/3 "2024-12-23T15:32:32Z")

</div>

> [@Northern\_Condor1](#):
>
> vtkAppendFilter

Hello,

If you don’t want point merging, why not use `vtkGroupDataSets` to generate a `vtkPartitionedDataSetCollection`?

Otherwise, add another scalar array for all your datasets which denotes the dataset index, use a name like “DataSetId”. After that, apply [VTK: vtkGenerateGlobalIds Class Reference](https://vtk.org/doc/nightly/html/classvtkGenerateGlobalIds.html) on each input dataset. That algorithm adds a new “GlobalPointIds” array with point IDs. Then add all those into `vtkAppendFilter`. One thing to note is that you cannot rely upon `vtkAppendFilter` to merge coincident points if `MergePoints` is on and the inputs have the “GlobalPointIds”.

Use at the “DataSetId” and the “GlobalPointIds” array to map points on the output back to a point in the input dataset.
