15

I have two shapefile layers in a Qgis project that have problems with zooming. One is a line I copied/pasted in a new layer from a set of height contours and the other one is a polygon layer I created by dissolving all features in another layer.

In both cases, the layers won't display unless the entirety of the layer shows in the canvas. When I zoom in or drag the view, as soon as part of the layer is out of the canvas the entire layer disappears.

In the case of the polygon layer, if I delete it and generate it again it works properly, but when I start filling the rings it reaches a point when it stops working well (I want to end up with a single polygon enclosing all features in the original layer). I guess it must have to do with the geometry of the layer, but I haven't found the cause.

Both layers previously worked well, and removing them/adding them again doesn't fix the issue.

All other layers in the project work well (including the set of height contours and the polygons layer I used to generate the troublesome layers).

This issue has shown in both Qgis 2.4 and 2.6

Is there anything I'm doing wrong?

  • I've had this issue with a few shapefiles, but not sure what is causing it... – DPSSpatial Jan 27 '15 at 18:05
  • 3
    Try rebuilding the spatial index. – Vince Jan 27 '15 at 18:26
  • 2
    I wonder if there is something wrong with the shapes like a corrupt or invalid geometry. Or a spatial index issue. – SaultDon Jan 27 '15 at 18:27
  • I regenerated the spatial index for both layers and they still don't show. I think it must be a geometry issue, since in the polygon layer the problem appears when I edit the vertices to delete rings. I'm editing the layer carefully to see if I can isolate the problem. – JPH Jan 27 '15 at 18:34
4

My coworkers and I were all having this problem in versions of QGIS that range from 2.6.1 to the new 2.14. The solution we worked out is to run:

Vector > Geometry Tools > Multiparts to Singlepart...

The new shapefile produced will now render at all zoom levels. I believe the issue is that the old shapefile had an incorrect ring order (presuming your file had internal rings) and the fix is therefore similar to running "Repair Geometry" in ArcMap.

  • I tried that out with a multipart line layer, and it worked. I now have multiple line entries in my polygon layer, which I wanted to avoid - that's the point of multipart features. I wonder why this happened, to avoid the problem in the future. Any comments? – R'n'E Jul 20 '17 at 7:12
2

Presuming you don't have scale dependent visibility set in the properties window...

I use GRASS for data cleaning, if you need to fill holes and undertake other topology work v.clean is a very good place to start.

  • 1
    Ran into this problem today. Running v.clean worked very well in QGIS 3.6.2. – Pooneil May 9 at 17:09
2

I was having the same problem. What solved it for me was using both what RickOrth said and what Vince said.

From the Layer>Properties>General Set the Coordinate reference system from a USER: to the correct system. Then click Create spatial index.

1

Check that the Coordinate reference system value under Layer Properties is set correctly. I have seen shapefiles with valid prj files reset this value to a Generated CRS(...) USER:10000x. This generated CRS can cause data to disappear in the same way data with no CRS set.

1

I went to Properties -> CRS - Create Spatial Index

Works now! Not sure if this is what @Vince meant but it worked.

-- EDIT --

I spoke too soon. My problem was that I had imported a .csv that had some NaNs in the Eastings/Northings. These got replaced with 1s. Once I got rid of those I had no problem.

  • @Vince meant to rebuild it, whereas it sounds like you didn't have one at all, but it amounts to the same thing. No spatial index, horrible performance. – John Powell Jun 23 '15 at 11:41
1

I had the same problem. In my case, the problematic shapefile had been created by ArcGIS. I fixed it by removing the useless extra files ESRI add to shapefiles (.cpg, .qpj, .sbx, and .shp.xml) keeping only the usefull ones (.dbf, .shp, .prj, .shx). Et voilà!

  • Great fix! I was in the same situation; using a .shp from a colleague that had been created in Arc. I moved the .dbf, .shp and .shx files to another folder (no .prj but didn't seem to matter), opened it in QGIS and then saved as another layer. Seems to be working fine. Thanks! – EcologyTom Jan 30 at 9:32
0

I have had this problem before too, especially when importing .shp files to a SpatialLite database. I found that a very simple way to fix it is to select every feature, turn on editor, use the Move feature tool, then simply click and release. You don't actually move any features but it forces the program to rewrite every vertex, and somehow, after this the geometry is fixed. It can take a while for large files but it has been sure fire for me.

0

I tried all the solutions presented here for a similar problem I had with a part of a polygon that disappeared when I zoomed in. The only one that worked for me was using v.clean from the processing toolbox with the rmdupl option and the tolerance set to 0. This removes all the duplicate nodes and gives a topologically correct file.

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.