def validateConnStr(self,cs): '''WFS basic checks. 1 url format,2 api key,3 ask for wfs''' if not re.search('^http://',cs,flags=re.IGNORECASE): raise MalformedConnectionString('\'http\' declaration required in LDS request') #if not re.search('wfs\.data\.linz\.govt\.nz',cs,flags=re.IGNORECASE): # raise MalformedConnectionString('Require \'wfs.data.linz.govt.nz\' in LDS address string') if not re.search('/[a-f0-9]{32}/(v/x|wfs\?)',cs,flags=re.IGNORECASE): raise MalformedConnectionString('Require API key (32char hex) in LDS address string') if not re.search('wfs\?',cs,flags=re.IGNORECASE): raise MalformedConnectionString('Need to specify \'wfs?\' service in LDS request') #look for conflicts ulayer = LU.getLayerNameFromURL(cs) return cs,ulayer
def parseSourceConfig(self,sc): '''If a user supplied their own LDS connection string, parse out relevant values''' self.source_str = sc #check for dates to set incr ufd = LU.getDateStringFromURL('from',sc) if ufd: ufds = ufd.group(1) ldslog.warn("Using 'from:' date string from supplied URL "+str(ufds)) self.fromdate = ufds utd = LU.getDateStringFromURL('to',sc) if utd: utds = utd.group(1) ldslog.warn("Using 'to:' date string from supplied URL "+str(utds)) self.todate = utds #if doing incremental we also need to check changeset if (utd or ufd) and not LU.checkHasChangesetIdentifier(sc): raise InputMisconfigurationException("'changeset' identifier required for incremental LDS query") #all going well we can now get the layer string. This isn't optional so we just set it self.layer = LU.getLayerNameFromURL(sc) ldslog.warn('Using layer selection from supplied URL '+str(self.layer))