[Tile-serving] [osm2pgsql-dev/osm2pgsql] hstore not importing some tags? (Discussion #2192)

Marcos Dione notifications at github.com
Sun Jun 2 12:11:41 UTC 2024


I'm not 100% sure this is a bug, so I start this as a discussion first.

I have a osm-carto fork where I specialize the rendering to my personal needs. The latest change I wanted to do was to not render the maritime borders, so I modified the country border query to this:

```sql
        (SELECT
            way,
            tags->'maritime' as maritime,
            admin_level
          FROM planet_osm_roads
          WHERE boundary = 'administrative'
            -- was:         IN ('2', '3')
            AND admin_level = '2'
            AND osm_id < 0
          -- ORDER BY admin_level DESC
        ) AS admin_low_zoom
```

just to find that `maritime` is not in the `tags`:

```
mdione at ioniq:~/src/projects/elevation/data/osm$ osmium show -f debug monaco-latest.osm.pbf | grep --color=no -E '(admin_level|*maritime")' | grep -B 1 maritime
grep: warning: * at start of expression
    "admin_level" = "10"
    "office"     = "maritime"
--
    "admin_level" = "10"
    "museum"          = "maritime"
--
    "admin_level"    = "2"
    "maritime"       = "yes"
--
    "admin_level"  = "2"
    "boundary"     = "maritime"
```

(granted, one has `maritime=yes` and the other `border=maritime`, but bare with me).

I import that  `.pbf`:

```
osm2pgsql --create --port 5432 --database mc --cache 0 --number-processes 8 --verbose --slim --flat-nodes /home/mdione/src/projects/elevation/data/osm/nodes.cache --hstore --multi-geometry --style /home/mdione/src/projects/elevation/osm-carto/openstreetmap-carto.style --tag-transform-script /home/mdione/src/projects/elevation/osm-carto/openstreetmap-carto.lua monaco-latest.osm.pbf
```

and check if it imported:

```sql
mdione at ioniq:~/src/projects/elevation$ psql -d mc
psql (16.3 (Debian 16.3-1))
Type "help" for help.

mc=# SELECT
            tags->'maritime' as maritime,
            admin_level
          FROM planet_osm_roads
          WHERE boundary = 'administrative'
            -- was:         IN ('2', '3')
            AND admin_level = '2'
            AND osm_id < 0;
 maritime | admin_level 
----------+-------------
          | 2
          | 2
          | 2
          | 2
(4 rows)
```

Am I doing something wrong or is this a bug?

Hint: I made no changes to `openstreetmap-carto.lua`, so this is not being stored as a column:

```sql
mc=# SELECT
            maritime,                    
            admin_level
          FROM planet_osm_roads
          WHERE boundary = 'administrative'
            -- was:         IN ('2', '3')
            AND admin_level = '2'
            AND osm_id < 0;
ERROR:  column "maritime" does not exist
LINE 2:             maritime,
                    ^
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/osm2pgsql-dev/osm2pgsql/discussions/2192
You are receiving this because you are subscribed to this thread.

Message ID: <osm2pgsql-dev/osm2pgsql/repo-discussions/2192 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20240602/33b195b4/attachment.htm>


More information about the Tile-serving mailing list