Exemplo n.º 1
0
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()


print "\n\n------------GeometryTest--------- \n",
TestGeom = "POINT (30 10)"
print "Static Test Geometry:", TestGeom
Exemplo n.º 2
0
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()
Exemplo n.º 3
0
ei = EIread(conn)
la = LAread(conn)
r = Rread(conn)
cv = CVread(conn)
s = Sread(conn)




print "Get all equipment: " ,eq.getAllEquipment()
print "Get all dataquality: " ,dq.getAllDataQuality()
print "Get all variable: " ,cs.getAllVariables()
print "Get all People: " ,cs.getAllPerson()#[0].PersonFirstName
print "Get all sites: " , sf.getAllSites()
print "Get all SamplingFeatures: ", cs.getAllSamplingFeature()
print "Get  SamplingFeatures by code: ",cs.getSamplingFeatureByCode(u'logan_river_outlet')



#shows that you can manipulate geometries within the code
#I can get back a union of two geometries( currently the Same Geometry),
#and convert from a string to Geometry type if it is in WKT

#Code that is being run
#Geom = self._session.query(Samplingfeature).first()
#TestGeom = "POINT (30 10)"
#GeomText = self._session.query(func.ST_Union(Geom.FeatureGeometry,func.ST_GeomFromText(TestGeom)).ST_AsText()).first()


print "\n\n------------GeometryTest--------- \n",
print cs.getGeometryTest()
Exemplo n.º 4
0
for x in allPeople:
    print x.PersonFirstName + " " + x.PersonLastName

# Get all of the SamplingFeatures from the database that are Sites
siteFeatures = core_read.getSamplingFeaturesByType('Site')
numSites = len(siteFeatures)
print "\n--------------- Information about Site SamplingFeatures ------------"
print "There are " + str(
    numSites
) + " Site SamplingFeatures in the ODM2 database retrieved using getSamplingFeaturesByType()."
print "The list of Site SamplingFeatures includes: "
for x in siteFeatures:
    print x.SamplingFeatureCode + ": " + x.SamplingFeatureName

# Now get the SamplingFeature object for a SamplingFeature code
sf = core_read.getSamplingFeatureByCode('USU-LBR-Mendon')
print "\n-------- Information about an individual SamplingFeature ---------"
print(
    "The following are some of the attributes of a SamplingFeature retrieved using getSamplingFeatureByCode(): \n"
    + "SamplingFeatureCode: " + sf.SamplingFeatureCode + "\n" +
    "SamplingFeatureName: " + sf.SamplingFeatureName + "\n" +
    "SamplingFeatureDescription: " + sf.SamplingFeatureDescription + "\n" +
    "SamplingFeatureGeotypeCV: " + sf.SamplingFeatureGeotypeCV + "\n"
    "SamplingFeatureGeometry: " + sf.FeatureGeometry + "\n" + "Elevation_m: " +
    str(sf.Elevation_m))

# Drill down and get objects linked by foreign keys
print "\n------------ Foreign Key Example --------- \n",
# Call getResults, but return only the first result
firstResult = core_read.getResults()[0]
print "The FeatureAction object for the Result is: ", firstResult.FeatureActionObj
Exemplo n.º 5
0
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()

print "\n\n------------GeometryTest--------- \n",
TestGeom = "POINT (30 10)"
print "Static Test Geometry:", TestGeom
print core_read.getGeometryTest(TestGeom)
Exemplo n.º 6
0
for x in allPeople:
    print x.PersonFirstName + " " + x.PersonLastName


# Get all of the SamplingFeatures from the database that are Sites
siteFeatures = core_read.getSamplingFeaturesByType('Site')
numSites = len(siteFeatures)
print "\n--------------- Information about Site SamplingFeatures ------------"
print "There are " + str(numSites) + " Site SamplingFeatures in the ODM2 database retrieved using getSamplingFeaturesByType()."
print "The list of Site SamplingFeatures includes: "
for x in siteFeatures:
    print x.SamplingFeatureCode + ": " + x.SamplingFeatureName


# Now get the SamplingFeature object for a SamplingFeature code
sf = core_read.getSamplingFeatureByCode('USU-LBR-Mendon')
print "\n-------- Information about an individual SamplingFeature ---------"
print ("The following are some of the attributes of a SamplingFeature retrieved using getSamplingFeatureByCode(): \n" +
       "SamplingFeatureCode: " + sf.SamplingFeatureCode + "\n" +
       "SamplingFeatureName: " + sf.SamplingFeatureName + "\n" +
       "SamplingFeatureDescription: " + sf.SamplingFeatureDescription + "\n" +
       "SamplingFeatureGeotypeCV: " + sf.SamplingFeatureGeotypeCV + "\n"
       "SamplingFeatureGeometry: " + sf.FeatureGeometry + "\n" +
       "Elevation_m: " + str(sf.Elevation_m))


# Drill down and get objects linked by foreign keys
print "\n------------ Foreign Key Example --------- \n",
# Call getResults, but return only the first result
firstResult = core_read.getResults()[0]
print "The FeatureAction object for the Result is: ", firstResult.FeatureActionObj