I am a beginner with QGIS and with no previous experience or expertise in Geography or GIS. I have an ESRI shapefile of New Zealand census area units (CAUs). My goal is to obtain distances between a selected CAU within the CBD of Auckland city and centroids of surrounding CAUs. There appears to be something wrong with linkage between the displayed map and the attribute table. When I select a CAU, the highlighted one in the attribute table is clearly not the CAU in question. For example, I clicked on a CAU in downtown central Auckland city and the highlighted CAU is a rural CAU about 150 km away. I tried creating a distance matrix; while some of the computed distances were plausible others were clearly wrong.
I thought that you would want me to attach the files but don't see any such facility on this web page.
To address some points raised, firstly in the attribute table I don’t see a ‘show selected only’ option, but there is a ‘move selection to top’ option. Secondly yes I was using one of the selection tools - the ‘select features by polygon’ one. Thirdly I realise that what I have is polygons and that only distances between points of the polygons can be measured. The distance matrix was being calculated on centroids.
There are two ways to select the area I am interested in.
(i) Go to View menu > select > select features by polygon. Then go to Layer menu > save selection as vector file. Change shapefiles by using ‘remove layer’ / add layer’ functions. With selected area now loaded, go to Vector menu > Geometry tools > Polygon Centroids > create centroids file. Add new layer to the TOC. Then Vector menu > analysis tools > distance matrix.
(ii) Since I already knew which CAUs I wanted to calculate distances for, the alternative was to edit the (whole country) DBF file in a spreadsheet, deleting all but the Auckland region.
If the choice is (i), then the selected area looks right in the map, but the areas in the attribute table are wrong. If the choice is (ii), then the attribute table is correct, but the areas depicted in the map are discrete or discontinuous parts of the whole country, instead of the Auckland region.
I presume by ‘manually selecting the layer’ you mean clicking on (highlighting) the correct layer in the layer panel of the GUI (which the User Guide calls the map legend).
I removed polygon layer, retaining the centroids layer, and performed multiparts to singleparts conversion. The feature count was the same.
If you need to know, coordinate reference system is set as
NZGD2000/New Zealand Transverse Mercator 2000.
So after addressing all the above points I still don't have a resolution.