4

I am having issues displaying a .shp file correctly in QGIS 2.12.3.

Sometimes when I add it to a map, it displays like the red lines in the photo below (which is how it should be). However, sometimes it displays as the gold lines in the other photo below (notice there are several lines missing in the top-center section).

I am afraid there is an issue with the geometry of the layer, but I haven't figured out how to diagnose it or fix it.

Note that the layer was created by joining together three different line layers. Originally these layers were not in the same projection, so I couldn't join them together. I thought I was able to change the layers to the same projection and join them together and thus successfully display the correct layer, but I fear I may have done something wrong.

Note that the red lines below only represents one of the original layers that was joined. So the remaining two component layers aren't always appearing as part of the combined layer as they should.

strong textenter image description here

  • Does the shapefile have a .sbn and .sbx files? – artwork21 Aug 16 '16 at 23:51
  • Can you share the file at dropbox or similar? – AndreJ Aug 19 '16 at 5:35
3

Since you noticed you did something wrong, you have to re-do the join.

Most probably you used Set Layer CRS or Assign Projection, which does NOT reproject correctly.

Use Save As ... to a different filename and a common CRS for all layers. Then remove the original layers, and turn On-the-fly-reprojection OFF to see if they still align. If yes, and both share the same column names in the attribute table you can safely merge them in one file with

  1. Select all features in the first layer
  2. Edit -> Copy features
  3. Switch the second layer to edit mode
  4. Edit -> Paste features

BTW By now, QGIS 2.16.1 is the current version, I suggest to upgrade.

  • Thank you AndreJ. I did do the Save As function rather than the first two methods you mentioned. I will try to restart from scratch and see what happens. How do you merge them using Copy and Paste? I didn't know that was possible. Also, I read somewhere that if the CRS of the shp layer is undefined, it won't necessarily work to just hit Save As and choose whatever CRS you want. I read that you have to know what the correct CRS of the data layer is supposed to be--is that correct or I can just choose one? Thanks so much Andre! – so5724x Aug 18 '16 at 21:46
  • If the CRS of the shapefile layer is undefined (e.g. .prj file is missing), you have to use Set Layer CRS. You have to know the right one (from the download website or else). If the coordinates are in degrees, EPSG:4326 works in most cases. – AndreJ Aug 19 '16 at 5:34

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.