Skip to content

Topology v2 #136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Nov 20, 2024
Merged

Topology v2 #136

merged 14 commits into from
Nov 20, 2024

Conversation

latot
Copy link
Contributor

@latot latot commented Nov 18, 2024

Improve explanation of basic types in topology.

And include geometry representation.

Copy link
Contributor

coderabbitai bot commented Nov 18, 2024

Caution

Review failed

The pull request is closed.

📝 Walkthrough
📝 Walkthrough

Walkthrough

The pull request involves the deletion of the file topology_base.rst, which provided an introduction to topology concepts in PostGIS, including nodes, edges, and faces. In its place, a new document titled topology_base_types.rst has been introduced, serving as an introductory guide to the same fundamental concepts. This new document details the definitions and roles of topology types, the Universal Face, and the structure of the edge_data table, among other related topics. Additionally, a new file topology_topo_types.rst has been added to provide a comprehensive guide on the representation of topology and geometry within PostGIS.

Changes

File Path Change Summary
postgis-intro/sources/en/topology_base.rst Deleted file providing an introduction to topology concepts in PostGIS, including nodes, edges, and faces.
postgis-intro/sources/en/topology_base_types.rst New document added that serves as an introductory guide to topology basic types, detailing nodes, edges, faces, and the structure of the edge_data table.
postgis-intro/sources/en/topology_topo_types.rst New document added that introduces the representation of topology and geometry in PostGIS, discussing TopoGeometries, layers, and TopoElements.
postgis-intro/sources/en/index.rst Updated to include new modules: topology_base_types and topology_topo_types in the "Workshop Modules" section.

Possibly related PRs

  • Topo intro #133: The changes in this PR also focus on introducing fundamental concepts of topology in PostGIS, including nodes, edges, and faces, which directly relate to the content of the deleted topology_base.rst file in the main PR.

Poem

In the land of PostGIS, where topologies play,
Nodes and edges dance in a geometric ballet.
A new guide emerges, bright and clear,
Teaching us topology, bringing us cheer!
With faces and structures, we’ll navigate right,
In the world of data, we’ll take flight! 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Outside diff range and nitpick comments (4)
postgis-intro/sources/en/topology_base_types.rst (4)

6-7: Fix grammar in prerequisite statement

The sentence has incorrect grammar. Consider revising to:
"Before reading this document, please check at least one of these documents:"


25-27: Enhance type definitions for clarity

Consider making the definitions more precise:

  • Node: "A 0-dimensional point that serves as a start or end point for edges"
  • Edge: "A directed 1-dimensional linestring that connects exactly two nodes"
  • Face: "A 2-dimensional polygon bounded by a closed sequence of edges"

38-41: Clarify Universal Face explanation

The explanation could be more precise. Consider:
"The Universal Face is a special face that represents the infinite area surrounding all other topological elements. It's not just empty space - it's a well-defined face that contains all other topology elements and has ID 0."


74-74: Fix typo in edge description

"organge" should be "orange"

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between e89afab and 867feb2.

⛔ Files ignored due to path filters (3)
  • postgis-intro/sources/en/topology/boros_universal_face.png is excluded by !**/*.png
  • postgis-intro/sources/en/topology/face_next_direction.png is excluded by !**/*.png
  • postgis-intro/sources/en/topology/next_edge.png is excluded by !**/*.png
📒 Files selected for processing (2)
  • postgis-intro/sources/en/topology_base.rst (0 hunks)
  • postgis-intro/sources/en/topology_base_types.rst (1 hunks)
💤 Files with no reviewable changes (1)
  • postgis-intro/sources/en/topology_base.rst
🔇 Additional comments (1)
postgis-intro/sources/en/topology_base_types.rst (1)

1-186: Overall documentation structure is well-organized

The document provides a comprehensive introduction to topology concepts with good use of visual aids and examples. The explanations are generally clear and the progression from basic concepts to more complex ones is logical.

However, there are several areas that need attention:

  1. Multiple placeholder section headers need to be replaced
  2. Some technical definitions could be more precise
  3. A few typos and incorrect column names need to be fixed

Despite these issues, the document is a significant improvement over the previous version and provides valuable information for understanding PostGIS topology.

Copy link
Member

@strk strk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's great to see this work, keep it up !


To correctly represent a topology and their forms, there are some definitions that are used to construct the tables that store everything, the edge is on the more complex ones.

All the information about edges are stored on the edge_data table, in your custom topology schema, and which information do we need in the edges? basically its nodes and faces information, edge is the primitive who connects both.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I'd document edge_data in the workshop, as it is mostly an implementation detail. The important thing to document is the edge view, which is also defined by the standard.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mm, this docs are mainly focused on the implementations, how to interpret, to be able how to use.

Topology is harder than SF, and does not has a lot of operation, any operation we want to create even for personal use we can need this information.

even on the start I wrote:

In this workshop, we will check some fundamentals of topology, its basics and definitions. It is not intended to be a way to use them directly, is to understand it to then be able to use it easily.

I'll write clearly the edge view.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the Topology Hierarchy I changed how I wrote it, has first a section closer to the User, and then more specific aspects of the concepts.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🧹 Outside diff range and nitpick comments (8)
postgis-intro/sources/en/topology_base_types.rst (3)

6-7: Fix grammar in the introduction

The sentence should be rephrased for better clarity.

-Before read this document, at least check one of this documents:
+Before reading this document, please review at least one of these documents:

31-31: Fix grammar and improve clarity

The sentence structure needs improvement.

-Is good to know, until now Postgis will save all this information internally, each type has its own unique ID, and with it we can edit and change them using the available functions, for example with ST_RemEdgeNewFace you can remove an edge and create a new face.
+It's important to note that PostGIS stores all this information internally. Each type has its own unique ID, which can be used to edit and modify them using available functions. For example, ST_RemEdgeNewFace can be used to remove an edge and create a new face.

33-33: Consider expanding on advanced concepts

The sentence introduces important concepts (Layers, TopoGeometry, TopoElement) but doesn't explain them. Consider adding brief descriptions or linking to the relevant sections where these concepts are explained in detail.

postgis-intro/sources/en/topology_topo_types.rst (5)

1-5: Consider adding a table of contents

The document would benefit from a table of contents to improve navigation. In RST, you can add this using the .. contents:: directive.

 .. _topology:

 Topology and Geometry Representation
 ====================================
+
+.. contents:: Table of Contents
+   :depth: 2

53-66: Enhance features section with a table format

Consider using an RST table to present the feature types and their identifiers more clearly.

 Features
 --------
 
+.. list-table:: Feature Types
+   :header-rows: 1
+
+   * - Type ID
+     - Feature
+   * - 1
+     - Nodes
+   * - 2
+     - Edges
+   * - 3
+     - Faces
+   * - 4
+     - Geometry Collections
-
-Features will represent which type the set of geometries will be, is not important if you use TopoGeometries or Primitives, in the end a Layer can contain directly or indirectly any of this sets:
-
-- (1) Nodes
-- (2) Edges
-- (3) Faces
-- (4) Geometry Collections

67-91: Improve organization of hierarchical layers section

The section could benefit from a more structured approach to explaining parent-child relationships.

Consider:

  1. Adding a clear definition of hierarchical layers upfront
  2. Using bullet points for key concepts
  3. Adding a "Limitations" subsection for lines 88-90

Example structure:

Hierarchical Layers, Children and Parents
---------------------------------------

Definition
~~~~~~~~~~
A hierarchical layer system in PostGIS topology allows for the organization of geometric elements in a parent-child relationship.

Key Concepts
~~~~~~~~~~~
* Parent layers contain larger groupings of geometric elements
* Child layers contain the smaller components that make up parent elements
* Each layer can only have one child layer within the same topology schema

Limitations
~~~~~~~~~~
* Cannot reference partial TopoGeometries
* Cannot mix layers from different hierarchies
* Current implementation restricts multiple child layers

115-176: Standardize header formatting and improve structure

The section uses inconsistent header decorations and could benefit from better organization.

  1. Standardize header decorations:
 Relation's Table
-----------------
+===============

 Keys and Identifiers we know now
-<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+--------------------------------

 Implicit identifiers on Keys
->>>>>>>>>>>>>>>>>>>>>>>>>>>>
+---------------------------
  1. Consider adding a summary table for the relation table's structure:
.. list-table:: Relation Table Structure
   :header-rows: 1

   * - Column
     - Description
   * - topology_id
     - Identifier of the topology (implicit)
   * - layer_id
     - Identifier of the layer
   * - element_id
     - Identifier of the element
   * - element_type
     - Type of the element

177-229: Standardize formatting and enhance technical explanations

The TopoGeometry components section needs consistent formatting and clearer technical explanations.

  1. Standardize header decorations:
 Find Components of a TopoGeometry
-<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+--------------------------------

 Reading TopoElements
-<<<<<<<<<<<<<<<<<<<<
+-------------------
  1. Consider adding a flowchart or diagram showing the process of reading TopoElements:
.. code-block:: text

    TopoGeometry

    Check child_id

    ┌─────┴─────┐
    ↓           ↓
   NULL     Not NULL
    ↓           ↓
 Primitive  TopoGeometry
    ID         Key
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 867feb2 and a93b4f7.

⛔ Files ignored due to path filters (7)
  • postgis-intro/sources/en/topology/components.png is excluded by !**/*.png
  • postgis-intro/sources/en/topology/geomtable2topotable.png is excluded by !**/*.png
  • postgis-intro/sources/en/topology/hierarchy.png is excluded by !**/*.png
  • postgis-intro/sources/en/topology/read_topoelement.png is excluded by !**/*.png
  • postgis-intro/sources/en/topology/topo_keys.png is excluded by !**/*.png
  • postgis-intro/sources/en/topology/topogeo2components.png is excluded by !**/*.png
  • postgis-intro/sources/en/topology/topology_main_concept.png is excluded by !**/*.png
📒 Files selected for processing (2)
  • postgis-intro/sources/en/topology_base_types.rst (1 hunks)
  • postgis-intro/sources/en/topology_topo_types.rst (1 hunks)
🔇 Additional comments (1)
postgis-intro/sources/en/topology_base_types.rst (1)

183-183: ⚠️ Potential issue

Fix incorrect column name

The column name abs_next_right_face should be abs_next_right_edge to match the actual column name in the edge_data table.

-abs_next_right_face: Next edge who build the face on the right.
+abs_next_right_edge: Next edge who builds the face on the right.

Likely invalid or redundant comment.

@latot latot changed the title [WIP] Topology v2 Topology v2 Nov 20, 2024
@latot
Copy link
Contributor Author

latot commented Nov 20, 2024

@strk The documentation is ready!

@robe2 robe2 merged commit 3b31e91 into postgis:master Nov 20, 2024
@coderabbitai coderabbitai bot mentioned this pull request Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants