1

I have loaded a shapefile into QGIS that has been generated in a third party piece of software. When I view the attributes table, all items are there (20 survey lines), when I view the map only 19 appear. I have also tried adding an extra feature in the Attribute table and giving it the same field information as the missing item but this is also not drawn. Any ideas?

  • Which "hird party piece of software" does this data come from? Did you checked it's geometry (it may be there, but far far away because of anything wrong in its coordinates)? Using the 'zoom to full extent' may help detecting such issue. – s.k Aug 23 '18 at 8:02
  • It is the survey company's inhouse software, a bit of a black-box so as a freelancer I'm not able to investigate how it works. I've checked the coordinates and done the zoom-extents and it's not there. If I input the same coords as a line string it plots ok. – Will Hutchins Aug 23 '18 at 8:16
  • This is not a one-off. I have loaded 3 separate Shapefiles created by the Third Party software and each one has the last feature missing. – Will Hutchins Aug 23 '18 at 8:21
  • 1
    I have seen once a MultiLineString containing a LineString with only 1 point (No idea how the company managed to write that file without errors) The attribute table was there, I could select the feature and the geometry seemed selected, but when I was zooming in it disappeared. Are you familiar with python and fiona/shapely? you can open the file and iterate over the geometries, printing them and look for something strange. – ImanolUr Aug 23 '18 at 8:46
  • 2
    If the black-box software uses tables or text files for input, ask someone to try changing the input file--does the last line of data have a carriage return? If not, add and rerun. If it does, ask them to add a blank line at the end and rerun the software. – mkennedy Aug 23 '18 at 16:10
2

First select from the attribute table the feature which is missing and save it as a separated layer. Is it still undisplayed?

Try to check its geometry using the field calculator. Add a new field with geom_to_wkt( $geometry ) as expression.
(If you have only the one feature you don't even have to add the field, you have a preview after typing the expression)

Won't fix your problem. But now you know its geometry you will be more aware of what's happening.

2

If every shapefile is missing the last feature then I would think the error is coming from the "blackbox" exporting to shapefile. You should ask to see the code that is used for exporting to shapefile.

1

The issue feels similar to this one but it is corrected in GDAL four years ago https://trac.osgeo.org/gdal/ticket/5608. The changeset https://trac.osgeo.org/gdal/changeset/27577 does even contain a test case.

Do you know if the blackbox software happens to use an ancient shapelib version which is less than 1.2.7?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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