Opened 8 years ago

Closed 8 years ago

#6534 closed defect (fixed)

OSM driver: Problem with spatial filter and multipolygons

Reported by: damiandixon Owned by: warmerdam
Priority: normal Milestone:
Component: Docs Version: 2.0.0
Severity: normal Keywords: OSM
Cc:

Description

I am seeing some unexpected behavior while using a spatial filter with openstreetmap data.

I have attached 2 screenshots:

-gdalosm_withoutfilter.png: The affected area loaded via OGR, with no spatial filter set ​​ The ​image shows a dotted line – this is the spatial filter. The rendering has gone a bit nuts because of the missing points making a very invalid polygon. Which is why we noticed that there was a problem.

-gdalosm_withfilter.png: The affected area loaded via OGR, with a spatial filter set. The polygon is drawn as expected.​

I would ​have ​expect​ed the returned polygon to extend past the spatial filter. This behavior has not been encountered with any other data format.

My copy of GDAL has not been built against GEOS. This behavior appears to be caused by the spatial filter check in OGROSMDataSrouce::NotifyNodes

--Snip (ogrosmdatasource.cpp line 813)-- void OGROSMDataSource::NotifyNodes(unsigned int nNodes, OSMNode* pasNodes) { ​​

unsigned int i;

const OGREnvelope* psEnvelope =

papoLayers[IDX_LYR_POINTS]->GetSpatialFilterEnvelope();

for(i = 0; i < nNodes; i++) {

/* If the point doesn't fit into the envelope of the spatial filter */ /* then skip it */ if( psEnvelope != NULL &&

!(pasNodes[i].dfLon >= psEnvelope->MinX &&

pasNodes[i].dfLon <= psEnvelope->MaxX && pasNodes[i].dfLat >= psEnvelope->MinY && pasNodes[i].dfLat <= psEnvelope->MaxY) )

continue;

Attachments (2)

gdalosm_withfilter.png (24.7 KB ) - added by damiandixon 8 years ago.
gdalosm_withfilter.png
gdalosm_withoutfilter.png (37.3 KB ) - added by damiandixon 8 years ago.
gdalosm_withoutfilter

Download all attachments as: .zip

Change History (3)

by damiandixon, 8 years ago

Attachment: gdalosm_withfilter.png added

gdalosm_withfilter.png

by damiandixon, 8 years ago

Attachment: gdalosm_withoutfilter.png added

gdalosm_withoutfilter

comment:1 by Even Rouault, 8 years ago

Component: defaultDocs
Resolution: fixed
Status: newclosed

Yes the OSM driver is particular in many ways due to the format itself being not simple feature oriented. I thought this particularilty was already documented, but apparently not.

trunk r34319 "OSM: document particularities of spatial filtering (#6534)"

Note: See TracTickets for help on using tickets.