Пример #1
0
    def nextAddress( self ):
        if self._ds == None:
            return None
        while True:
            self._record = self._ds.next()
            if self._record == None:
                return
            if self._record:
                break
        func = self.getField
        self._nextid += 1
        id = self.evaluateDefinition( func, self._iddefn )
        roadname = self.evaluateDefinition( func, self._roaddefn )
        number = self.evaluateDefinition( func, self._numberdefn )
        status = self.evaluateDefinition( func, self._statusdefn, 'UNKN' )
        comment = self.evaluateDefinition( func, self._commentdefn, '' )
        parcelID = self.evaluateDefinition( func, self._parcelIDdefn, '' )
        appellation = self.evaluateDefinition( func, self._appellationdefn, '' )
        landdistrict = self.evaluateDefinition( func, self._landdistrictdefn, '' )
        x = self.evaluateDefinition( func, self._xdefn )
        y = self.evaluateDefinition( func, self._ydefn )
        transform = True
        
        point = ''
        # Geocode from coordinates
        if x != '' and y != '': 
            x=float(x)
            y=float(y)
            point = 'POINT(%f %f)' % (x,y)
        # Geocode from parcel ID
        if (point.upper() == 'NONE' or point == '') and parcelID is not None and parcelID.strip().isdigit():
            pid = int(parcelID.strip())
            point = str(Database.executeScalar('elc_findparcelpoint', pid))
        # Geocode from appellation
        if (point.upper() == 'NONE' or point == '') and appellation != '' and appellation is not None:
            if landdistrict is not None and landdistrict.strip().isdigit():
                pid = Database.executeScalar('elc_findparcelid', appellation.strip(), int(landdistrict.strip()))
            else:
                pid = Database.executeScalar('elc_findparcelid', appellation.strip(), None)
        if pid is not None:
                point = str(Database.executeScalar('elc_findparcelpoint', pid))
                transform = False
        # Otherwise leave empty 
        if point.upper() == 'NONE' or point == '':
            point = 'POINT EMPTY'

        return AddressData( id, roadname, number, point, status, comment, transform )
Пример #2
0
 def createFromLandonlineAddress( job, sad_id, status ):
     from Job import Job
     assert isinstance(job,Job)
     return Database.executeScalar(
         'elc_CreateAddressFromLandonline',
         job.id(),
         sad_id,
         status
         )
Пример #3
0
 def createAddress( job, data, transform = True ):
     from Job import Job
     assert isinstance(job,Job)
     assert isinstance(data,Reader.AddressData)
     itransform = 1 if transform else 0
     return Database.executeScalar(
         'elc_CreateAddress',
         job.id(),
         data.id(),
         data.status(),
         data.roadname(),
         data.number(),
         data.comment(),
         data.location(),
         itransform
         )
Пример #4
0
 def CreateUpload( cls, filename=None ):
     if not filename:
         filename = Upload.defaultNewFilename()
     id = Database.executeScalar('elc_CreateUpload',getuser(),filename)
     return Upload(id)
Пример #5
0
 def refreshLandonlineLinks( self ):
     return Database.executeScalar('elc_refreshJobLinks',self._id)
Пример #6
0
 def CreateJob( cls, sup_id, description, sourcename ):
     user = getpass.getuser()
     jobid = Database.executeScalar( 
         'elc_CreateJob',sup_id,description,sourcename,user
         )
     return Job(jobid)
Пример #7
0
 def createNewAddress (self, job_id, wkt):
     adr_id = Database.executeScalar('elc_CreateAddress', job_id, '', '', '', '', '', wkt, 0)
     return Address( self, adr_id )