4

I have a shapefile with a few hundred street lamp posts. There is an attribute, "lamp-id" and I need to enter the lamp id for each feature. A "lamp_id" is three letters and two digits BTW.

I was given a DWG file that contains this information. However, the placement of the lamp posts in the DWG is not accurate (my shapefile is from a surveyor, the DWG contains the projected placement). So I need to copy the "lamp-id" from the DWG file to the shapefile for each lamp post.

I know that this can be automated/scripted in some way, but that is a challenging task which I am not ready to take on. Instead I want to just import the DWG and have it displayed with 50% opacity, and then I want to enter the lamp_id for each feature in the shapefile.

In the screenshot below, the DWG-layer contains the text and the purple dots, while my shapefile is shown as red crosses.

enter image description here

This can be done by clicking each feature with the mouse and in one of a few ways enter the correct value in the correct field. But that is way too slow and requires a lot of mouse clicking.

Ideally I want to jump from feature to feature when I hit the enter button. So I only need to press as follows:

KVU-01 <ENTER>
KVU-02 <ENTER>
KVU-03 <ENTER>
EVU-11 <ENTER>
EVU-12 <ENTER>
etc

I want to somehow automatically pan to the selected feature for which I am about to enter the value.

I imagine there must exist Plugins for doing this or something similar?

How I imagine a tool like this:

enter image description here

3
  • 1
    Have you tried join attributes by nearest?
    – Erik
    Jan 6 at 11:42
  • @I appreciate your suggestion, and I will look into it sooner or later, but for now I would prefer to manually enter, but as efficient as possible. For several reasons the automation is much harder than you would think. I got in fact 13 DWG files. And each file contains 20+ layers with non-intuitive names. The text label in the DWG files is not associated with the symbol representing the placement of the lamp, and in some cases the text label is so far from it that it would not work. Jan 6 at 11:52
  • Manually? Ugh! Maybe I missed it, but what software are your using? This is easy to do in AutoCAD Civil 3D or Map 3D.
    – Pointdump
    Jan 6 at 17:06
6

Your dream tool look a lot like standard QGIS functionality.

You just need to create a form on your Layer with only the "Lamp_ID" field set as text edit :

enter image description here

Then you open the attribute table in form view (the setting is in the bottom right corner of the attribute table and you should see something like that :

enter image description here

On the right part you get the Lamp_ID field ready to fill (dont forget to turn your layer on edit mode), on the left you have a list of all point. When you click on a point in the list it will zoom to this point. You may order the list on the left by Lamp_ID so the point where the Lamp_ID are null will appear on top of the list (the setting is on the dropdown just above the list)

The only difference with your dream tool is that pressing enter will do nothing, you will need to click on a feature on the list to go to the next point (and dont forget to save your edit at regular interval).

EDIT :

As said by @Matt in comment you may need to activate the zoom to feature option (click the magnifying glass at the bottom of the list), just next to it you may also choose the pan to feature option if you want to work at your prefered zoom level)

1
  • The Automatically zoom to the current feature button may have to be toggled also (magnifying glass under the feature list). Nice solution, I really should use attribute forms more.
    – Matt
    Jan 6 at 14:38
2

Pressing Ctrl + J will zoom to the selected feature (or Ctrl + P will pan, while the attribute table has focus). I often assign these to my mouse button 4 or 5. This allows me to select a row in the attribute table and then zoom to the feature with one click.

Additionally, in Settings -> Keyboard Shortcuts there is a keyboard shortcut Edit next feature in attribute table (default Ctrl + Alt + [). I tried this quickly, but I couldn't get it to work. Perhaps you have more luck.

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.