I've got a shape file that I loaded into PostGIS that has both road and parcel multipolygons and I need to remove the roads. I tried loading the shp file in qgis and it loads them both as a single layer. I need to remove roads as best I can without removing parcels. I can remove most of them by testing whether the address is equal to null. However this deletes parcels where that data is unavailable.

My idea is to create another filter that tests the complexity of the geometry since most roads are complex polygons and parcels are generally simple (not all). Then I think I will find a "close enough" solution where most roads are removed, and little to no parcels are removed.

Here is what I've looked at to no avial:

st_isSimple : tests whether a polygon is anomalous (self intersection or tangent)

st_numPoints : Does not work because it only looks at the first linestring and there are no linestrings

Some others...

Anyway, what ideas do you have for classifying a polygon as a road? Is there a query I can do? A feature I can extract offline?


  • 1
    Generally there should be an attribute coded to the road and parcel polys that would allow you to run a simple query definition against the dataset to filter out just the features you are after. Without seeing a sample of the shapefile, it will be tough to get help on this one. Could you share a small sample shapefile online somewhere (like dropbox) or other file-sharing service? Dec 21, 2011 at 22:44
  • 1
    +1 @RyanDalton - are there no other attributes that you can select on besides address? Maybe a combination of the two? Polygon complexity seems like a complicated step backwards.
    – Radar
    Dec 21, 2011 at 23:50
  • Is there any way you could find a centreline road network of the same area, and do an intersection? Any road polygons that intersect the centreline file could then be deleted. Dec 22, 2011 at 0:27
  • As Ryan says, without a sample it's difficult to help you. A question: are road polygons overlaid on top of parcel polygons or just touching them?
    – Igor Brejc
    Dec 22, 2011 at 6:24
  • Unfortunately the data is proprietary, and I am not allowed to make it publicly available. What would you look for in the shape file? Maybe I could look for it on QGIS?
    – Nate
    Dec 22, 2011 at 18:16

1 Answer 1


Any legit parcel data should be packing around a parcel number attribute.

I would expect to find a field named parcel_num, or a similarly-named field, that distinguishes true parcel polygons. Any roads melted into that feature class would likely be null or have a default value such as 0 in that field.

Next, I would compare the count of all features having a parcel_num attribute to a count of all features that are null/empty in the parcel_num field. This doesn't exactly solve a problem, but helps you get a silhouette of the good data contrasted against the bad. It can also help prime your thinking. For example:

-- first get a count of everything..
Count(*) FROM parcels; 

-- then compare with one or both of these:
Count(*) FROM parcels WHERE parcel_num = ''; 
Count(*) FROM parcels WHERE parcel_num IS NULL;

Finally, I'd just split out the valid parcel features (those with a parcel number) into a fresh table, then "eyeball" the leftovers as a stand-alone dataset. Unless your data is truly awful, it should be easy at this point to identify actual parcels with missing attributes from the road polygon clutter.

You could use QGIS to help you visualize various data queries. This screenshot montage shows how I got from a raw parcels shapefile down to the 60+ rows that had an empty string for the parcel number:

enter image description here

And this image shows a close-up of some of the results in my "ambiguous" set. As you can see, it's pretty easy to see at a glance which features are true parcels:

enter image description here

Once you get this far, I'd be very surprised if it took more than a couple hours to clean up your dataset.

  • Thanks, I tried similar things, but with the addresses and owners. I looked at the parcel ids and the apn numbers, but even the roads have both apn and parcel numbers.
    – Nate
    Dec 26, 2011 at 20:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.