[gdal-dev] ogr2ogr: strange results joininig non-spatial CSV to spatial data using SQLite dialect
aborruso
aborruso at gmail.com
Sun Dec 1 06:59:27 PST 2019
Hi,
I have this geosjon (map.geojson)
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {"id": 1},
"geometry": {
"type": "Point",
"coordinates": [-78.653, 35.7874]
}
},
{
"type": "Feature",
"properties": {"id": 2},
"geometry": {
"type": "Point",
"coordinates": [-78.6298, 35.7873]
}
},
{
"type": "Feature",
"properties": {"id": 3},
"geometry": {
"type": "Point",
"coordinates": [-78.6408, 35.7795]
}
}
]
}
and this CSV (tbl.csv)
id,atrr
1,ipsum
2,lorem
3,amet
If I run
ogr2ogr -f csv \
-dialect sqlite \
-sql "select map.*,tbl.atrr from map join 'tbl.csv'.tbl AS tbl on
cast(map.id as text) = tbl.id" \
/vsistdout/ map.geojson
I have
id,atrr
"1",ipsum
If I use left join instead of join I have
id,atrr
"1",ipsum
"2",lorem
"3",amet
Why do I not have three rows of result using simply join?
I'm using GDAL 2.4.2, released 2019/06/28
--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html
More information about the gdal-dev
mailing list