dq =DQread(conn) anno = Annoread(conn) eq = EQread(conn) pr = PRread(conn) ep = EPread(conn) ei = EIread(conn) la = LAread(conn) r = Rread(conn) cv = CVread(conn) s = Sread(conn) #print "Get Geometry Test 1: ",cs.getGeometryTest() print "Get all equipment: " ,eq.getAllEquipment() print "Get all dataquality: " ,dq.getAllDataQuality() print "Get all variable: " ,cs.getAllVariables() print "Get all People: " ,cs.getAllPersons()#[0].PersonFirstName print "Get all sites: " , sf.getAllSites() print "Get all SamplingFEatures: ", cs.getAllSamplingFeatures() print "Get SamplingFEatures by code: ",cs.getSamplingFeatureByCode("USU-LBR-Mendon") #print "GeometryTest2: ",cs.getGeometryTest() #factory = cs._session_factory.getSession() #print factory.query(Samplingfeature).all()
# create a connection for each of the schemas. Currently the schemas each of a different # connection but it will be changed to all the services sharing a connection core_read = CSread(conn) core = CoreServices(conn) result_read = Rread(conn) sampfeat_read = SFread(conn) # run some basic sample queries. vars = core.read.getAllVariables() print "Get all variable: ", vars people = core_read.getAllPersons() print "Get all People: ", people sfs = core_read.getAllSamplingFeatures() print "Get all SamplingFeatures: ", sfs temp = sfs[0] print temp.SamplingFeatureCode val = core.read.getSamplingFeatureByCode(temp.SamplingFeatureCode) sf = core_read.getSamplingFeatureByCode(u"logan_river_outlet") print "Get SamplingFeatures by code: ", sf # The following query shows that you can manipulate geometries within the code # I can get back a union of two geometries # and convert from a string to Geometry type if it is in WKT # Code that is being run: # Geom = self._session.query(Samplingfeature).first() # GeomText = self._session.query(func.ST_Union(Geom.FeatureGeometry,func.ST_GeomFromText(TestGeom)).ST_AsText()).first()
#conn = dbconnection.createConnection('postgresql', 'castro-server.bluezone.usu.edu', 'ODM2', 'postgres', 'postgres') #create a connection for each of the schemas. Currently the schemas each of a different #connection but it will be changed to all the services sharing a connection core_read = CSread(conn) core = CoreServices(conn) result_read = Rread(conn) sampfeat_read = SFread(conn) #run some basic sample queries. vars = core.read.getAllVariables() print "Get all variable: ", vars people = core_read.getAllPersons() print "Get all People: ", people sfs = core_read.getAllSamplingFeatures() print "Get all SamplingFeatures: ", sfs temp = sfs[0] print temp.SamplingFeatureCode val = core.read.getSamplingFeatureByCode(temp.SamplingFeatureCode) sf = core_read.getSamplingFeatureByCode(u'logan_river_outlet') print "Get SamplingFeatures by code: ", sf #The following query shows that you can manipulate geometries within the code #I can get back a union of two geometries #and convert from a string to Geometry type if it is in WKT #Code that is being run: #Geom = self._session.query(Samplingfeature).first() #GeomText = self._session.query(func.ST_Union(Geom.FeatureGeometry,func.ST_GeomFromText(TestGeom)).ST_AsText()).first()