# NarrativeWeb: duplication of places in list

**URL:** <https://gramps.discourse.group/t/narrativeweb-duplication-of-places-in-list/9489>\
**Category:** Development\
**Tags:** narrativeweb\
**Created:** [May 15, 2026, 9:17am UTC](https://gramps.discourse.group/t/narrativeweb-duplication-of-places-in-list/9489 "2026-05-15T09:17:35Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![pgerlier](https://avatars.discourse-cdn.com/v4/letter/p/41988e/32.png) [@pgerlier](https://gramps.discourse.group/u/pgerlier)\
**Post date:** [May 15, 2026, 9:17am UTC](https://gramps.discourse.group/t/narrativeweb-duplication-of-places-in-list/9489/1 "2026-05-15T09:17:35Z")

</div>

Gramps 6.0.8, Fedora Linux 44 under KDE Plasma Desktop

Some places appear duplicated in `Places` tab of NarrativeWeb, e.g.:

 ![image](https://global.discourse-cdn.com/free1/uploads/gramps/original/2X/2/21682cedb5fc6b59bfa1c45868787ef48616d473.png)

(look at Dingy-Saint-Clair and Doussard)

Duplicated entries point onto the same place description page (hash inside the link is the same when you hover over the name).

Duplication seems to happen randomly. It does not seem to be related to `Enclosed by` feature, not to `Alternate Names` (places in the screenshot have none). The number of duplications is itself a mystery. It is not correlated to the number of references

I tried to look at the code (_gramps/gramps/plugins/webreport/place.py_) to see how the list is generated but I gave up quickly as it requires deep knowledge of the _Report_ class.

Perhaps @SNoiraud could give me some clue.

Another issue occurs with alternate names. I expect them to be listed, pointing onto the same description page. I don’t find them all. It is likely the reason is these alternate names are not referenced by events. But this is a bit confusing because a place is mainly known by its modern name and having only the used “outdated” name in the list can make it difficult to find requested data.

---

<div class="post-metadata">

**Author:** ![SNoiraud](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/snoiraud/32/72_2.png) [@SNoiraud](https://gramps.discourse.group/u/SNoiraud)\
**Post date:** [May 15, 2026, 9:32am UTC](https://gramps.discourse.group/t/narrativeweb-duplication-of-places-in-list/9489/2 "2026-05-15T09:32:41Z")

</div>

> [@pgerlier](#):
>
> I tried to look at the code (_gramps/gramps/plugins/webreport/place.py_) to see how the list is generated but I gave up quickly as it requires deep knowledge of the _Report_ class.

The place list is created in narrativeweb.py. You have the \_add\_place method which creates the place list.

are you sure you have no duplicates ?

---

<div class="post-metadata">

**Author:** ![pgerlier](https://avatars.discourse-cdn.com/v4/letter/p/41988e/32.png) [@pgerlier](https://gramps.discourse.group/u/pgerlier)\
**Post date:** [May 15, 2026, 12:34pm UTC](https://gramps.discourse.group/t/narrativeweb-duplication-of-places-in-list/9489/3 "2026-05-15T12:34:24Z")

</div>

> [@SNoiraud](#):
>
> are you sure you have no duplicates ?

I confirm there are no duplicates in _Places_ list view of Gramps. I also checked directly in the DB with an SQLite “sniffer”.

> [@SNoiraud](#):
>
> in narrativeweb.py. You have the \_add\_place method which creates the place list.

Isee there are two dicts related to places:

- `obj_dict[Place][…]` indexed by `place_handle`, thus guaranteeing unicity, providing a list of “properties”
- `obj_dict[PlaceName][…]` indexed with the current name + grampsId, registering all names with a link to an item in the previous dict

_But I am confused by the presence of `event` in the stored list. What is the role of this element? When a place is met several times (which is expected), `event` is overwritten and only the last seen is available._

The index is built by method `placelistpage(…)` in _place.py_ by traversing `obj_dict[PlaceName]`. Each item is added as a list `(p_name, [(handle, place_name)])`.

Comments in `addRecord(…)` says that duplicates are allowed. Consequently, if there are, they come from `obj_dict[PlaceName]` and I don’t see how this is possible unless the computed `p_name` is different. But if names are different, how can they be printed the same (I checked there are no spaces)? Duplicated names don’t use alternate spellings not language.

Any idea? Even like adding debugging print.

---

<div class="post-metadata">

**Author:** ![SNoiraud](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/snoiraud/32/72_2.png) [@SNoiraud](https://gramps.discourse.group/u/SNoiraud)\
**Post date:** [May 15, 2026, 3:23pm UTC](https://gramps.discourse.group/t/narrativeweb-duplication-of-places-in-list/9489/4 "2026-05-15T15:23:17Z")

</div>

Can you send me a small example of your database reproducing the problem ?

---

<div class="post-metadata">

**Author:** ![pgerlier](https://avatars.discourse-cdn.com/v4/letter/p/41988e/32.png) [@pgerlier](https://gramps.discourse.group/u/pgerlier)\
**Post date:** [May 15, 2026, 5:01pm UTC](https://gramps.discourse.group/t/narrativeweb-duplication-of-places-in-list/9489/5 "2026-05-15T17:01:22Z")

</div>

I am trying to “extract” from my live database but it is really huge. Deleting people, leaving places untouched, causes errors “handle does not exist” when generating NarrativeWeb.

I tried another approach.

I added debugging prints in method `_add_place` to dump the access key into `obj_dict[PlaceName]`. This key is `place_name`+`:`+gramp\_id.

`place_name` is the expansion of the “enclosed by” structure.

In the debugging output, I get as many different `place_name`s as duplications in the report, i.e. the “expansions” must be used somewhere to be listed. This means duplication is not systematic; it must be referenced to be listed. However, in the places list, only the first component of the expansion is shown (hamlet, village/town, etc.) is shown, giving the illusion of duplicates.

So, unless the access key mentioned above is filtered (ignore second+ components), nothing can be done. Grouping on the handle would do it but alternate names would be lost.

I attach the beginning of the sorted debugging dump for your information.

Should it be considered as a bug?  
[sorted.txt.pdf](https://gramps.discourse.group/uploads/short-url/x9DgXN4MYpVyQ3VMW43Nx3vR2vk.pdf) (132.8 KB)

_Remove extension .pdf from filename. It is a plain text file but I had to cheat on the Discourse engine to upload it._

---

<div class="post-metadata">

**Author:** ![SNoiraud](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/snoiraud/32/72_2.png) [@SNoiraud](https://gramps.discourse.group/u/SNoiraud)\
**Post date:** [May 15, 2026, 6:04pm UTC](https://gramps.discourse.group/t/narrativeweb-duplication-of-places-in-list/9489/6 "2026-05-15T18:04:00Z")

</div>

If I remember correctly, in 5.1, I needed to show all places and alternate names depending on date. I think this is why we have events attached to the place in the tables.

I don’t see any problems with the attached file.

---

<div class="post-metadata">

**Author:** ![pgerlier](https://avatars.discourse-cdn.com/v4/letter/p/41988e/32.png) [@pgerlier](https://gramps.discourse.group/u/pgerlier)\
**Post date:** [May 15, 2026, 6:59pm UTC](https://gramps.discourse.group/t/narrativeweb-duplication-of-places-in-list/9489/7 "2026-05-15T18:59:10Z")

</div>

I have understood how the issue appears. I’ll prepare a test tree tomorrow (1 person, 1 place, 2 events). You can then study how to cope with it.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/gramps/original/1X/2ac1e712b7adf612e31ca08a55419f4cf37c0158.png) [@system](https://gramps.discourse.group/u/system)\
**Post date:** [June 14, 2026, 6:59pm UTC](https://gramps.discourse.group/t/narrativeweb-duplication-of-places-in-list/9489/8 "2026-06-14T18:59:26Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
