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

osm INTERLEAVED_READING how to specify or can it be #217

Open
robe2 opened this issue Jun 29, 2021 · 1 comment
Open

osm INTERLEAVED_READING how to specify or can it be #217

robe2 opened this issue Jun 29, 2021 · 1 comment

Comments

@robe2
Copy link
Contributor

robe2 commented Jun 29, 2021

I was trying to link this file using ogr_fdw and got slapped with the turn on INTERLEAVE notice.

https://download.geofabrik.de/europe/belarus-latest.osm.pbf

I tried this:

CREATE SERVER svr_osm FOREIGN DATA WRAPPER ogr_fdw
OPTIONS (
    datasource '/fdw_data/belarus-latest.osm.pbf', 
    config_options 'OGR_INTERLEAVED_READING=YES',
    format 'OSM'
);

But then the tables all come up empty.

I also tried INTERLEAVED_READING=YES but it said option not available.
In GDAL 3.1 I can use ogr2ogr without specifying this option as it's turned on by default I guess since GDAL 2.2

SELECT ogr_fdw_version();

outputs:
OGR_FDW="1.1" GDAL="3.2.1"

So not sure why I can't get it to work. Can you try it. Way easier than trying to fumble with ogr2ogr if I can get it to work.

Using QGIS GDAL 3.1.4

I can load fine with this command:

ogr2ogr -f "PostgreSQL" PG:"dbname=gisdb" -lco SCHEMA=staging -lco GEOMETRY_NAME=geom belarus-latest.osm.pbf

@pramsey
Copy link
Owner

pramsey commented Jul 26, 2023

The points table doesn't come up empty. But I get the same issues otherwise. All other tables empty if the option is provided, and an error message if it is left off.

DROP SERVER svr_osm CASCADE;
CREATE SERVER svr_osm FOREIGN DATA WRAPPER ogr_fdw
OPTIONS (
    datasource '/tmp/belarus-latest.osm.pbf', 
--    open_options 'INTERLEAVED_READING=YES',
    config_options 'OGR_INTERLEAVED_READING=YES CPL_DEBUG=YES',
    format 'OSM'
);

DROP SCHEMA IF EXISTS osm CASCADE;
CREATE SCHEMA osm;

SET search_path = public,osm;

IMPORT FOREIGN SCHEMA ogr_all FROM SERVER svr_osm INTO osm;

SELECT count(*) FROM lines;
SELECT count(*) FROM points;

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

No branches or pull requests

2 participants