4

I have a shp file which is the output of the Toolbox Check validity tool in QGIS 3.4.3 The points display for me correctly but if I then join the layer with a csv attribute using the toolbox Join Attributes by Field Value to create a new layer the points no longer display on my map.

If I then select 1 of the features using the attribute table and use the zoom map to selected feature I get the error

Cannot zoom to selected feature No extent could be determined

I have also tried to associate the attribute table using the Layer properties Join but I end up in a similar position.

Looking at the layer properties it seems the extent value is lost in the processing but I'm not able to restore it using the "Update Extent" option on the Joined layer properties.

Anyone know how to solve my issue?

Updates

  • I tried the multipart to single part suggested in the comments but that didn't work.
  • Also if I try to filter the valid layer itself manually by creating a valid expression to only show the points with a specific value ColName in ('ID1') (which I know in the csv file) all the points disappear and I cannot zoom to the selected. This seems to me to point to an issue with my points layer not the join but not sure what.

Joined Layer

  • Encoding windows-1258
  • Geometry Point (MultiPoint)
  • CRS EPSG:4326 - WGS 84 - Geographic
  • Extent Empty
  • Unit degrees
  • Feature count 46

Valid Layer

  • Encoding windows-1258
  • Geometry Point (MultiPoint)
  • CRS EPSG:4326 - WGS 84 - Geographic
  • Extent -10.4506078999999996,51.4353689000000003 -6.0394994000000004,55.3615765999999994
  • Unit degrees
  • Feature count 4,735
5
  • What's your accuracy when joining attributes? Have you tried saving the layers before joining?
    – Erik
    Jan 4, 2019 at 14:44
  • My Joined layer contains 46 features (46 matches between the attribute table and the points layer based on my selected keys). I have saved the valid layer and tried joining via the layer properties but in order to only show the features where the join matches I am prompted to create a virtual layer and that seems to be where the extent is lost and no points are displayed
    – Michael
    Jan 4, 2019 at 15:05
  • I have seen the same message when trying to zoom to a feature with invalid geometry.
    – Chau
    Jan 10, 2019 at 15:39
  • Any ideas how the geometry could gets invalidated if it's possible to view before the join?
    – Michael
    Jan 10, 2019 at 19:56
  • I can not reproduce the issue. What I would try is to run the Multipart to singleparts tool on the point layer before joining it. Jan 13, 2019 at 12:32

3 Answers 3

1

I can think of two possible workarounds:

-Create new point layer, copy/paste features in it and Join Attributes by Field Value with csv.

-In your point layer, create new fields for your geometry with field calculator (X, Y): enter image description here Join Attributes by Field Value with csv.

If you dont see points use Create Points Layer from table tool: enter image description here

If any of this works, might be something wrong with Check validity tool and should be reported.

0

Today, just working on same scenario, similar (but not the same) issues.

I suspect the csv provider is not robust. Try converting your csv data to shapefile without geo attributes.

I'n my case, I spent some time to - create at *.csvt file to complement the *csv - clean the *.csv file of characters such as , ; " ' By clean I mean use libre office sheet to replace all with a space. And I'm still running with the csv.

A major clue, is that the number of attributes noted in your join layer is different to the number of attributes in your index layer. That was also evident in my situation.

4
  • I use TAB delimited format for my csv files, unlikely that any spurious tabs are going to be introduced into the text strings from the source data, as opposed to data entry operators who put in ' " , / etc when all the need write is X MARKS THE SPOT
    – BJW
    Jan 14, 2019 at 11:37
  • I'm not sure what you mean by convert the csv data into shape file without geo attributes
    – Michael
    Jan 14, 2019 at 11:50
  • "Once you've got the csv layer loaded (and presuming it is not riddled with ; " ' , as I note above) , right click on the layer and save as Esri shapefile .
    – BJW
    Jan 17, 2019 at 9:39
  • I ended up creating custom csv files outside QGIS that merged the Geometry data with the source file into a new file. When I imported it the points were plotted. I'm not sure if it will stand up to other additional QGIS tasks but it gets the points displayed for the moment
    – Michael
    Jan 20, 2019 at 15:53
0

Solution provided at the bottom using a virtual layer.

I had the same problem on a polygon layer dissolving polygons based on an attribute. I wanted to label NYC neighborhood table with borough name and not neighborhood name.

So not like this:

enter image description here

But like this:

enter image description here

The solution was to use a virtual layer for creating a point layer for labeling.

Using st_union resulted in Queens and Brooklyn not being label due to the error:

No extent could be determined

Using st_unaryunion solved the problem:

SELECT BORONAME, st_centroid(st_unaryunion(geometry)) as geometry /*:point:26918*/
FROM nyc_neighborhoods
GROUP BY BORONAME

Your Answer

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

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