SOLVEDFollowing a comment below saying the script works for another user, I created a greatly simplified Overpass query to pull the missing data and it works fine. This tells me that the nodes are missing from the source query results so there's actually nothing wrong with my LUA script. Thanks for the replies, if I can't work out the issue with the overpass query I'll open another question. Hopefully I won't have to :) I've been working on a LUA import script for osm2pgsql and once I had it all working I checked the database in qgis and found that some ways are missing. I can see them in the source XML file (from overpass), with all their node references but osm2pgsql does not import them. I've created a small test script to try and visualise what is happening
The above script is run with the following CLI arguments to version 1.7.0 which I compiled myself:
This script does not add the missing lines to the test table but does tell me at all four of the I've also imported the same data using the default style and the way does not appear in the lines table.
All this suggests dodgy data but the way exists and does have a geometry in OSM itself https://www.openstreetmap.org/way/987525760 While this is one specific way, there are a few I've spotted due to familiarity with the area. Some, like this one are missing while a few others seem to be a straight line from the first to last node without other nodes in between. Can anyone explain why this way is not being imported? Versions:
asked 29 Aug '22, 14:57 DarkSnow |
There is a whole lot of information missing in your question, the most important one: are you using 'pgsql' or 'flex' output? You can't mix both. If you create a LUA file designed for flex, you need to use the flex output parameters on the command line to have it properly function. The same for pgsql. Don't mix them up. Read the osm2pgsql manual carefully: https://osm2pgsql.org/doc/manual.html and realize chapters 6 (for flex) and 7 (pgsql) there should be treated as wholly separate information: either you need to read 6, or 7, depending on the choice of output. If you choose one, then forget about the information in the other chapter, as it won't be relevant. answered 30 Aug '22, 07:37 mboeringa Thanks for that response. It's a lua script so I'm using flex, but I also tried pgsql with the default style and the way wasn't imported. I thought I was clear but I'll update the question to clarify and add the command line options.
(30 Aug '22, 10:50)
DarkSnow
|
I'm not familiar with rendering, but looking at the tags, I'd say it's because there's no rendered tags on this way. Probably there are filters to keep only known tags. answered 29 Aug '22, 19:37 H_mlet |
https://github.com/gravitystorm/openstreetmap-carto/blob/master/openstreetmap-carto.lua is a fairly minimal implementation for the normal backend - maybe start from there and amend the functions you want to change as required?
As other mentioned before, you should at least post the complete command line you have been using as well as the version number of osm2pgsql. Otherwise we are stumbling in the dark. When I try your script, osm2pgsql fails with an error message, so I would expect this not to put any data in the database. When I remove the offending lines (those with
as_multilinestring()
andas_multipolygon()
) the script runs through add adds that way to the database.Jochen, it's very interesting that the script is working for you. The print lines are for testing, but work fine for me on version 1.7.0, so can be safely removed.
If the way is being imported for you, how are you getting the source data?
I'm using the following query to get data from overpass: