Package aisutils :: Module wkb
[hide private]
[frames] | no frames]

Source Code for Module aisutils.wkb

 1  #!/usr/bin/env python 
 2  __author__ = 'Kurt Schwehr' 
 3  __version__ = '$Revision: 8545 $'.split()[1] 
 4  __revision__  = __version__ # For pylint 
 5  __date__ = '$Date: 2008-02-06 17:37:24 -0500 (Wed, 06 Feb 2008) $'.split()[1] 
 6  __copyright__ = '2008' 
 7  __license__   = 'GPL v2' 
 8  __contact__   = 'kurt at ccom.unh.edu' 
 9   
10  __doc__=''' 
11  AIS database utilities. 
12   
13  @status: under development 
14  @since: 2008-Feb-07 
15  @undocumented: __doc__ parser 
16   
17  @requires: U{GeoTypes<http://www.initd.org/tracker/psycopg/wiki/GeoTypes>} >= 0.7.0 
18   
19  @todo: Switch to GeoDjango so that this becomes irrelevant 
20  ''' 
21   
22  #@requires: U{psycopg2<http://http://initd.org/projects/psycopg2/>} >= 2.0.6 
23  #import psycopg2 
24  #import psycopg2.extensions 
25  import GeoTypes 
26   
27 -class convert:
28 ''' 29 Simple wrapper to make decoding WKB Hex a lot simpler 30 '''
31 - def __init__(self):
32 self.factory = GeoTypes.OGGeoTypeFactory() 33 self.parser = GeoTypes.HEXEWKBParser(factory)
34 - def decode(wkbhex):
35 ''' 36 Convert a WKB Hex string to an object. This is a factory, no? 37 38 c = convert() 39 c.decode("0020000001000010E6C051D30925D1DA0B4044A79AE924F228") 40 41 @param wkbhex: HEX geometry 42 @type wkbhex: str 43 @return: Different geometry objects depending on what you give it. e.g. 44 @rtype: Geotypes object 45 ''' 46 parser.parseGeometry(wkbhex) 47 geom = factory.getGeometry() 48 return geom
49