1

I'm trying to plot a series of contours in QGIS based on dxf data exported from some specialised mining software. The attirbute output is pretty ugly and merges a few fields together.

DXFName=C5ドル DXFGroup= DXFFeature= DXFValue=50.0 DXFDescription=Major contour at level 50.000 DXFPrimitive= DXFLine=0 DXFPattern=0

I need to extract just the 'DXFValue=' value to allow categorised symbology, and labelling of the contours.

I've played around with rule based symbology using the 'regexp_substr' function, but I don't have the regex knowledge to produce what I need.

Anyone able to assist?
Thanks!

Antonio Falciano
14.5k2 gold badges38 silver badges68 bronze badges
asked Aug 7, 2013 at 4:51

1 Answer 1

3

You can use the following expression to extract the values you want:

regexp_replace("test", '.*DXFValue=([0-9\.\-]{1,}).*', '\1円')

This function replaces the entire string with the first matched group (the '\1円'), which is the string contained in the brackets '([0-9\.\-]{1,})', coming after 'DXFValue='.

Remember to set the output field type to 'Decimal number (real)'.

field calculator

answered Aug 7, 2013 at 8:44
1
  • 3
    regexp_substr has just been fixed to return the first match group, regexp_substr('yourstring', 'DXFValue=(\\d*.\\d*)') should now work. github.com/qgis/Quantum-GIS/commit/… Commented Aug 8, 2013 at 4:23

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.