# Create topological features in pygplates and have issue when resolve these features

**URL:** https://discourse.gplates.org/t/create-topological-features-in-pygplates-and-have-issue-when-resolve-these-features/287
**Category:** Q&A
**Created:** [28 March 2021 15:52 UTC](https://discourse.gplates.org/t/create-topological-features-in-pygplates-and-have-issue-when-resolve-these-features/287 "2021-03-28T15:52:45Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![LavieNguyen](https://discourse.gplates.org/letter_avatar_proxy/v4/letter/l/6de8d8/32.png) [@LavieNguyen](https://discourse.gplates.org/u/LavieNguyen)
#### Post date: [28 March 2021 15:52 UTC](https://discourse.gplates.org/t/create-topological-features-in-pygplates-and-have-issue-when-resolve-these-features/287/1 "2021-03-28T15:52:45Z")

</div>

Hello everyone:

I have tried to create topological features from regular or reconstructable features (gpml:PassiveContinentalBoundary or gpml:SubductionZone) in pygplates. When I loaded these topological features in GPlates, these features behaved as what I understood of topological features. And my understand about a topological feature is as the following:

1. Topological feature can have any pygplates.FeatureType (gpml:PassiveContinentalBoundary or gpml:SubductionZone or gpml:MidOceanRidge)
2. Topological feature does not need to have a PlateID or any other attributes because the topological feature has references to regular or reconstructable features that make up the topological feature. These regular or reconstructable features have all required attributes - PlateID, valid time, name, etc.
3. When one wants to resolve topological features, make sure to include both topological features and regular or reconstructable features that topological features have references as the input to pygplates.resolve\_topology.

I am not sure what I have done wrong that I could not resolve the topological features I previously created in pygplates. There was no Error message from pygplates.resolve\_topology; however, the output is empty. I have checked to make sure that I indicated the valid time. I also included both topological features and regular/reconstructable features as the input to pygplates.resovle\_topology.

Will you please give me advice or suggestion with this issue? Thank you so much.

---

<div class="post-metadata">

### Author: ![john.cannon](https://discourse.gplates.org/letter_avatar_proxy/v4/letter/j/3e96dc/32.png) [@john.cannon](https://discourse.gplates.org/u/john.cannon)
#### Post date: [29 March 2021 12:16 UTC](https://discourse.gplates.org/t/create-topological-features-in-pygplates-and-have-issue-when-resolve-these-features/287/2 "2021-03-29T12:16:54Z")

</div>

Hi Lavie,

What you describe sounds correct.

Usually this problem is related to Feature IDs in one way or another. Have a look at [this post](https://discourse.gplates.org/t/trouble-creating-boundary-topologies/269/3) which covers two possible issues with feature IDs (duplicated IDs or a Shapefile mapping problem).

If that doesn’t solve the problem then feel free to send me some files that reproduce the problem and I’ll have a look.

Regards,  
John

---

<div class="post-metadata">

### Author: ![LavieNguyen](https://discourse.gplates.org/letter_avatar_proxy/v4/letter/l/6de8d8/32.png) [@LavieNguyen](https://discourse.gplates.org/u/LavieNguyen)
#### Post date: [29 March 2021 19:17 UTC](https://discourse.gplates.org/t/create-topological-features-in-pygplates-and-have-issue-when-resolve-these-features/287/3 "2021-03-29T19:17:42Z")

</div>

Dear John:

Thank you so much for your help. After following your suggestions in the previous post, I still could not solve the issue. I checked to make sure that my topological features had references to reconstructable features and these gpml files were included in the input to pygplates.resolve\_topology. Thus, I herein enclose the link to the Shared OneDrive folder which contains input files and Python file that I created to test pygplates.resolve\_topology. The link can only be accessed through your email (I believed I sent the link to your email already). Many thanks for your time and your guidance.

---

<div class="post-metadata">

### Author: ![john.cannon](https://discourse.gplates.org/letter_avatar_proxy/v4/letter/j/3e96dc/32.png) [@john.cannon](https://discourse.gplates.org/u/john.cannon)
#### Post date: [30 March 2021 07:09 UTC](https://discourse.gplates.org/t/create-topological-features-in-pygplates-and-have-issue-when-resolve-these-features/287/4 "2021-03-30T07:09:44Z")

</div>

Hi Lavie,

Thanks for sending the input files and Python test script!

I noticed all your topologies are [topological lines](https://www.gplates.org/docs/pygplates/generated/pygplates.ResolvedTopologicalLine.html).

By default [pygplates.resolve\_topologies()](https://www.gplates.org/docs/pygplates/generated/pygplates.resolve_topologies.html) only outputs resolved _boundaries_ and _networks_. This is because most use cases do not want the building blocks of plate/network boundaries (ie, _lines_). If you want to output the resolved _lines_ you can specify that with the _resolve\_topology\_types_ parameter (see code below).

So, in your case, you’ll want to change…

```python
resolved_topologies = []
resolved_topological_sections = []
pygplates.resolve_topologies(
    topological_features,
    rotation_model,
    resolved_topologies,
    time,
    resolved_topological_sections,
    anchor_plate_id = 700)

```

…to…

```python
resolved_topologies = []
pygplates.resolve_topologies(
    topological_features,
    rotation_model,
    resolved_topologies,
    time,
    anchor_plate_id = 700,
    resolve_topology_types = pygplates.ResolveTopologyType.line)

```

Note that I’ve removed your `resolved_topological_sections` argument since it’s not going to have anything meaningful in it since you only have topological lines (ie, not boundaries or networks). In fact if I had left that in then an error would have occurred (unless you also specified the `resolve_topological_section_types` argument to include _boundaries_ and/or _networks_, and then `resolved_topological_sections` would have been empty anyway).

---

<div class="post-metadata">

### Author: ![LavieNguyen](https://discourse.gplates.org/letter_avatar_proxy/v4/letter/l/6de8d8/32.png) [@LavieNguyen](https://discourse.gplates.org/u/LavieNguyen)
#### Post date: [30 March 2021 16:17 UTC](https://discourse.gplates.org/t/create-topological-features-in-pygplates-and-have-issue-when-resolve-these-features/287/5 "2021-03-30T16:17:57Z")

</div>

Dear John:

Thank you so much for your time and your help with the issue. In your explanation, I notice you said that by default pygplates.resolve\_topologies() would only output resolved boundaries and networks. I am confused because I thought my topological features were tectonic boundaries. I understand these features are topological lines but their feature types are pygplates.FeatureType.gpml\_subduction\_zone or pygplates.FeatureType.gpml\_mid\_ocean\_ridge. Thus, my question is how I correctly interpret/understand/define _‘boundaries’_ in topological features?

Once again, many thanks for taking time to provide detailed explanation - as you always do 😁

---

<div class="post-metadata">

### Author: ![john.cannon](https://discourse.gplates.org/letter_avatar_proxy/v4/letter/j/3e96dc/32.png) [@john.cannon](https://discourse.gplates.org/u/john.cannon)
#### Post date: [31 March 2021 12:00 UTC](https://discourse.gplates.org/t/create-topological-features-in-pygplates-and-have-issue-when-resolve-these-features/287/6 "2021-03-31T12:00:00Z")

</div>

Hi Lavie,

Your features are topological lines because their geometries are [topological lines](https://www.gplates.org/docs/pygplates/generated/pygplates.gpmltopologicalline) (and in your GPML files you’ll see `<gpml:TopologicalLine>`).

The _feature type_ (such as `pygplates.FeatureType.gpml_subduction_zone`) does play a role in this but the only role it plays is to restrict the types of geometries allowed (as determined by the GPlates Geological Information Model - GPGIM). So a SubductionZone feature type only allows lines (not polygons or networks) since it’s really meant to be a line feature.

Now if you created a topological feature in pyGPlates using, for example, [pygplates.Feature.create\_topological\_feature](https://www.gplates.org/docs/pygplates/generated/pygplates.feature#pygplates.Feature.create_topological_feature) there’s a _verify\_information\_model_ parameter that can disable this GPGIM restriction (but then you might have a little trouble loading that into GPlates). Ultimately we want to loosen up the GPGIM in this regard, but for now, if you want a topological boundary I would choose a feature type that is used for _boundary_ features (subduction zones are really meant to be _line_ features). A `gpml:TopologicalClosedPlateBoundary` is probably your best bet.

---

<div class="post-metadata">

### Author: ![LavieNguyen](https://discourse.gplates.org/letter_avatar_proxy/v4/letter/l/6de8d8/32.png) [@LavieNguyen](https://discourse.gplates.org/u/LavieNguyen)
#### Post date: [31 March 2021 16:27 UTC](https://discourse.gplates.org/t/create-topological-features-in-pygplates-and-have-issue-when-resolve-these-features/287/7 "2021-03-31T16:27:46Z")

</div>

Dear John:

Thanks for your careful explanation.
