Skip to content
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

include database link between geoms in geojson_geometries and individual features in a tile.data feature collection #10831

Open
whatisgalen opened this issue Apr 24, 2024 · 2 comments · May be fixed by #11056
Labels
Audience: Developer The audience for the issue is a software developer

Comments

@whatisgalen
Copy link
Member

whatisgalen commented Apr 24, 2024

This issue is essentially about the fact that each geospatial feature exists independent of the tile and resource it's associated with because there can be N features per tile. Basically if you're looking for a particular geom via its featureid, you can't find it via the database, only ES. If a given tile has N geoms, the db doesn't know one from the other except via that integer primary key. I would characterize a solution to this as "Nice to Have" as opposed to "necessary" because the "id" property on the feature is part of the ES terms index, so each individual feature is searchable if you know that id. This change
included in PR #10827 also ensures that when we create new tiles with known feature ids they don't get overwritten.

@whatisgalen whatisgalen added the Audience: Developer The audience for the issue is a software developer label Apr 24, 2024
@chiatt
Copy link
Member

chiatt commented Apr 26, 2024

Hey @whatisgalen, could you provide a little more detail on what needs to be done for this ticket?

@whatisgalen whatisgalen changed the title include reference to a geojson geometry on each feature in tile.data include database link between geoms in geojson_geometries and individual features in a tile feature collection Apr 28, 2024
@whatisgalen whatisgalen changed the title include database link between geoms in geojson_geometries and individual features in a tile feature collection include database link between geoms in geojson_geometries and individual features in a tile.data feature collection Apr 28, 2024
@whatisgalen
Copy link
Member Author

whatisgalen commented Jun 18, 2024

@chiatt sorry for the delay on this. It's surfaced as a blocker to #10816

When an MVT request gets sent, the features in the response are defined thus out of the geojson_geometries table:

"""SELECT ST_AsMVT(tile, %s, 4096, 'geom', 'id') FROM (SELECT tileid,
                            id,
                            resourceinstanceid,
                            nodeid,
                            ST_AsMVTGeom(
                                geom,
                                TileBBox(%s, %s, %s, 3857)
                            ) AS geom,
                            1 AS total
                        FROM geojson_geometries
                        WHERE nodeid = %s and resourceinstanceid not in %s) AS tile;""",
                        [nodeid, zoom, x, y, nodeid, resource_ids],

The issue is that when you click on a popup, an int feature.id from geojson_geometries gets compared against a uuid tile-based feature.id. The part of the code where the resource_descriptors bring in that tile data is here. So the feature.id property is a uuid that looks nothing like the id property coming from geojson_geometries and in #10827 if I try to compare a clicked feature against the feature properties available via resource_descriptors, I'll never have a match on feature.id despite comparing features with identical geometries.

Essentially we're maintaining two parallel ids for the same feature: an int feature id in geojson_geometries and a uuid feature id in tile.data...geometries...{feature}. I think we should either conform them to a single common featureid, or else maintain a link in geojson_geometries to the featureid used when saving geojson tile data here.

whatisgalen added a commit that referenced this issue Jun 18, 2024
@whatisgalen whatisgalen linked a pull request Jun 18, 2024 that will close this issue
11 tasks
@whatisgalen whatisgalen linked a pull request Jun 18, 2024 that will close this issue
11 tasks
whatisgalen added a commit that referenced this issue Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Audience: Developer The audience for the issue is a software developer
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

2 participants