The idea behind getting Azimuth & Distance from existing points is to verify that a property is correctly mapped by comparing map data to a land survey report. When an error is found, then I would enter the correct value and have the polygon replotted. Other ways to do this to be sure, but this approach seems in my mind to be simpler.

I have modified the dmsToDd function to accept Az in form of '- m N 12,23 E' where '-' allows use of bearing as entered in survey drawing which may be in reverse direction 'm' says entries are in magnetic (compass) values. most of local surveys are this way. Unfortunately the magnetic correction should probably be a Project Level option. ',' is what I chose to separate deg,min,sec. Could be most anything I suppose.

I tested this outside of qGIS and it gives the correct azimuth. I cannot test in qGIS as the plugin always freezes when I click 'draw' no matter what I enter. Could you provide me a sample set of inputs that works so I can see what I am doing wrong? for me the following inputs will cause a freeze.
600 ft @ 377.78deg
1900 ft @ 97 deg
1045 ft @ 179 deg
630 ft @ 278 deg
1213 ft @ 300 deg

Fred LaPlante
    def dmsToDd(self,dms):
        "patch to allow az in form: e.g. '-m N 25,34,40 E' - fl 9Nov2009"
        "minus sign allows handling bearings given in reverse direction"
        "'m' flags inputs as using magnetic or compass values"
        # this value needs to be obtained from input form
        magDev = 12.5 # for Maine, USA
        dms = dms.strip()
        if (dms[0] == '-'):
          rev = True
          dms = dms[1:].strip()
        else:
          rev = False
        if (dms[0] == 'm'):
          dev = magDev
          dms = dms[1:].strip()
        else:
          dev = 0.0
        baseDir = dms[0].upper()
        if (baseDir in ['N','S']):
          adjDir = dms[-1].upper()
          bearing = True
          if (baseDir == 'N'):
            if (adjDir == 'E'):
              base = 0.0
              adj = 'add'
            if adjDir == 'W':
              base = 360.0
              adj = 'sub'
          elif (baseDir == 'S'):
            base = 180.0
            if adjDir == 'E':
              adj = 'add'
            if adjDir == 'W':
              adj = 'sub'
        else:
          bearing = False
          
        "It's not fast, but it's a safe way of dealing with DMS"
        dms=dms.replace(" ", "")
        for c in dms:
            if not c.isdigit():
                dms=dms.replace(c,';')
        while (dms.find(";;")>=0):
            dms=dms.replace(";;",';')
        if dms[0]==';':
            dms=dms[1:]
        dms=dms.split(";")
        dd=0
        for i, f in enumerate(dms):
            if f!="":
                dd+=float(f)/pow(60, i)
        #dd=str(float(dms[0])+float(dms[1])/60+float(dms[2])/3600)
        
        "continuation of patch - fl 9Nov2009"
        if (rev):
          dd = dd+180
          if (dd > 360.0): dd = dd - 360.0
        if (bearing == True):
          if (adj == 'add'):
            dd = base + dd
          elif (adj == 'sub'):
            dd = base - dd
        dd = dd + dev
        
        return dd
    

_______________________________________________
Qgis-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to