GPSFileDepot.com
 

News:

Welcome to GPSFileDepot!

Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Longostino

#1
i found by reading ahead in the tutorial that the values to be created in MP_TYPE are literally '0x20', '0x21' and '0x22', not their ASCII or control equivalents.  Knowing that here is the code I created based on the original in the tutorial, but using the syntax the QGIS Field Calculator Expression Parser would accept as valid.  I believe I interpreted the logic correctly, and I have results that seem to reflect that interpretation:

CASE
WHEN "FCODE" = '10101' OR "FCODE" = '10104'  THEN '0x20'
WHEN  (  "FCODE"  = '10102' OR  "FCODE"  = '10105' ) AND ( "CONTOURELE" / ( "CONTOURINT" *10 )>100) AND regexp_match(  tostring(  abs(  (  "CONTOURELE"  /  (  "CONTOURINT"  * 10 ) )  / 100 -  toint( ( "CONTOURELE"  /  (  "CONTOURINT"  * 10 )  )  / 100 )  )  ) , '5' ) THEN '0x21'
WHEN  (  "FCODE"  = '10102' OR  "FCODE"  = '10105' ) AND ( "CONTOURELE" / ( "CONTOURINT" *10 )>10 ) AND  regexp_match(  tostring(  abs(  (  "CONTOURELE"  /  (  "CONTOURINT"  * 10 ) )  / 10 -  toint( ( "CONTOURELE"  /  (  "CONTOURINT"  * 10 )  )  / 10 )  )  ) , '5' ) THEN '0x21'
WHEN  (  "FCODE"  = '10102' OR  "FCODE"  = '10105' ) AND  regexp_match(  tostring(  abs(   "CONTOURELE"  /  (  "CONTOURINT"  * 10 )  -  toint( "CONTOURELE"  /  (  "CONTOURINT"  * 10  )  )  )  ) , '5' ) THEN '0x21'
WHEN  (  "FCODE"  = '10102' OR  "FCODE"  = '10105' ) THEN '0x22'
ELSE NULL END
#2
Thank you for all your work.  I am working through this tutorial, the latest version.  Most of it is working for me just fine, even though I am using Ubuntu Studio 14.04 LTS.  This means I have to accept slightly older versions of some of the software.  That is usually okay because I can still find my way around to the parts used in the tutorial.  One problem I had was the .BAT file.  I successfully reworked it into a BASH shell script (mergecontours.bat > mergedcontours.sh).  Now I am having trouble with the script that is supposed to be inserted in QGIS, mp_type, Expression field.  I am using QGIS 2.01-Dufour.  The script as written is invalid.  In fact, based on all the QGIS documentation, it is nothing like the syntax the Field Calculator suggests.  Undaunted, I thought I might rework the script using the suggested CASE WHEN condition THEN result END form.  That lead me to an even more frustrated state, because I am unfamiliar with your written syntax.  I imagine that the if (.... ,....,...) form suggests "if (this condition, return that result, otherwise...)."  If that is the case, it would seem the first case says, "if "FCODE" = '10101' OR "FCODE" = '10104', then return 0x20"  Following the rest of the code in a similar manner, the other conditions return, 0x21, 0x22 or NULL.  Now I am really confused.  Why do we need 15 characters for those results?  And are these supposed to be SPACE,  !, ", and NULL, respectively, or the decimal values, 32, 33, 34.  What seems to be written as conditions would make more sense, translating the result of dividing CONTOURELE by CONTOURINT, making it an integer by the power of 1, 10, or 100, depending on how big the result is.  So, what is the point of the conversion expression?  What is the result supposed to be?