Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 46,102,47,103,urn:ogc:def:crs:EPSG:6.6:4326,2
- # LOGIC TREE:
- # 1) Do we have an URI (something with ':' )
- # YES:
- # Get URI set to CRS
- # Is there a number in interval [1-4] after ?
- # YES:
- # number is dimension
- # NO:
- # pass
- # NO:
- # Assume EPSG:4326
- # Pop CRS/Dimension
- # 2) Number of numbers remaining
- # split into 2 (lower and upper conner)
- # Is dimension set:
- # YES:
- # pass
- # NO:
- # Get number of dimensions from len/2
- #
- testStr="46,102,47,56,urn:ogc:def:crs:EPSG:6.6:4326,2"
- testList=testStr.split(",")
- crsStr=None
- dimensions=None
- crsIndex=[idx for idx,item in enumerate(testList) if ':' in item]
- if len(crsIndex)>0:
- crsStr=testList[crsIndex[0]]
- #is there something after crs
- try:
- dimensions=int(testList[crsIndex[0]+1])
- except:
- pass #try to get dimension from the rest string
- #remove CRS and DIM
- testList=testList[:crsIndex[0]]
- else:
- crsStr="EPSG:4326"
- if type(dimensions) is type(None):
- dimensions=int(len(testList)/2)
- lowerList=testList[:dimensions]
- upperList=testList[dimensions:]
- print lowerList
- print upperList
- print crsStr
- print dimensions
Advertisement
Add Comment
Please, Sign In to add comment