|
9 | 9 |
|
10 | 10 | from odm2api.ODMconnection import dbconnection |
11 | 11 | from odm2api.ODM2.services.readService import * |
| 12 | +from odm2api.ODM2.services import CreateODM2 |
12 | 13 | # Create a connection to the ODM2 database |
13 | 14 | # ---------------------------------------- |
14 | 15 |
|
|
24 | 25 |
|
25 | 26 | #_session = session_factory.getSession() |
26 | 27 | read = ReadODM2(session_factory) |
| 28 | +create =CreateODM2(session_factory) |
27 | 29 |
|
28 | 30 |
|
29 | 31 |
|
|
80 | 82 | #add sampling feature |
81 | 83 | print "\n------------ Create Sampling Feature --------- \n", |
82 | 84 | try: |
83 | | - from odm2api.ODM2.models import SamplingFeatures |
84 | | - newsf = SamplingFeatures() |
| 85 | + # from odm2api.ODM2.models import SamplingFeatures |
85 | 86 | session = session_factory.getSession() |
86 | | - newsf.FeatureGeometry = "POINT(-111.946 41.718)" |
87 | | - newsf.Elevation_m=100 |
88 | | - newsf.ElevationDatumCV=sf.ElevationDatumCV |
89 | | - newsf.SamplingFeatureCode= "TestSF" |
90 | | - newsf.SamplingFeatureDescription = "this is a test to add Feature Geomotry" |
91 | | - newsf.SamplingFeatureGeotypeCV= "Point" |
92 | | - newsf.SamplingFeatureTypeCV=sf.SamplingFeatureTypeCV |
93 | | - newsf.SamplingFeatureUUID= sf.SamplingFeatureUUID+"2" |
94 | | - session.add(newsf) |
| 87 | + newsf = Sites(FeatureGeometryWKT = "POINT(-111.946 41.718)", Elevation_m=100, ElevationDatumCV=sf.ElevationDatumCV, |
| 88 | + SamplingFeatureCode= "TestSF",SamplingFeatureDescription = "this is a test to add Feature Geomotry", |
| 89 | + SamplingFeatureGeotypeCV= "Point", SamplingFeatureTypeCV=sf.SamplingFeatureTypeCV,SamplingFeatureUUID= sf.SamplingFeatureUUID+"2", |
| 90 | + SiteTypeCV="cave", Latitude= "100", Longitude= "-100", SpatialReferenceID= 0) |
| 91 | + |
| 92 | + create.createSamplingFeature(newsf) |
95 | 93 | #session.commit() |
96 | 94 | print "new sampling feature added to database", newsf |
97 | 95 |
|
|
0 commit comments