Skip to content

Commit 1010c1e

Browse files
authored
Merge pull request #116 from lsetiawan/sf_edit
Sf edit
2 parents 599d055 + 1111158 commit 1010c1e

File tree

2 files changed

+49
-10
lines changed

2 files changed

+49
-10
lines changed

odm2api/ODM2/models.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,18 +248,37 @@ class SamplingFeatures(Base):
248248
Where or on what an action was performed.
249249
"""
250250
SamplingFeatureID = Column('samplingfeatureid', Integer, primary_key=True, nullable=False)
251+
"""int: Primary key identifier."""
251252
SamplingFeatureUUID = Column('samplingfeatureuuid', String(36), nullable=False)
253+
"""str: A universally unique identifier for the sampling feature."""
252254
SamplingFeatureTypeCV = Column('samplingfeaturetypecv', ForeignKey(CVSamplingFeatureType.Name),
253255
nullable=False, index=True)
256+
"""str: CV term describing the type of sampling feature."""
254257
SamplingFeatureCode = Column('samplingfeaturecode', String(50), nullable=False)
258+
"""str: A short but meaningful text identifier for the sampling feature."""
255259
SamplingFeatureName = Column('samplingfeaturename', String(255))
260+
"""str: Sampling Feature name (free text)."""
256261
SamplingFeatureDescription = Column('samplingfeaturedescription', String(500))
262+
"""str: Text describing the sampling feature."""
257263
SamplingFeatureGeotypeCV = Column('samplingfeaturegeotypecv', ForeignKey(CVSamplingFeatureGeoType.Name),
258264
index=True)
265+
"""str: Dimensionality of SamplingFeature; point2d, line2d, etc."""
259266
Elevation_m = Column('elevation_m', Float(53))
267+
"""float: The elevation of the sampling feature in meters, or in the case of Specimen,
268+
the elevation from where the SamplingFeature.Specimen was collected"""
260269
ElevationDatumCV = Column('elevationdatumcv', ForeignKey(CVElevationDatum.Name), index=True)
261-
#FeatureGeometry = Column('featuregeometry', String(50))
270+
"""str: The code for the vertical geodetic datum that specifies the zero point for
271+
the Sampling Feature Elevation"""
272+
# FeatureGeometry = Column('featuregeometry', String(50))
273+
"""object: The location geometry of the sampling feature on the Earth expressed using a
274+
geometry data type. Can be a Point, Curve (profile, trajectory, etc),
275+
Surface (flat polygons, etc) or Solid/Volume (although often limited to
276+
2D geometries). """
262277
FeatureGeometryWKT = Column('featuregeometrywkt', String(50))
278+
"""str: The location geometry of the sampling feature on the Earth expressed as
279+
well known text (WKT). Can be a Point, Curve (profile, trajectory, etc.),
280+
Surface (flat polygons, etc.), or Solid/Volume (although often limited to
281+
2D geometries)."""
263282
__mapper_args__ = {
264283
# 'polymorphic_on': SamplingFeatureTypeCV,
265284
"polymorphic_on": case([

odm2api/ODM2/services/readService.py

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -363,15 +363,35 @@ def getProcessingLevels(self, ids=None, codes=None):
363363
"""
364364

365365
def getSamplingFeatures(self, ids=None, codes=None, uuids=None, type=None, wkt=None, results=False):
366-
"""
367-
getSamplingFeatures(self, ids=None, codes=None, uuids=None, type=None, wkt=None, results=False):
368-
* Pass nothing - returns a list of all sampling feature objects with each object of type specific to that sampling feature
369-
* Pass a list of SamplingFeatureID - returns a single sampling feature object for the given ids
370-
* Pass a list of SamplingFeatureCode - returns a single sampling feature object for the given code
371-
* Pass a list of SamplingFeatureUUID - returns a single sampling feature object for the given UUID's
372-
* Pass a SamplingFeatureType - returns a list of sampling feature objects of the type passed in
373-
* Pass a SamplingFeature Well Known Text - return a list of sampling feature objects
374-
* Pass whether or not you want to return only the sampling features that have results associated with them
366+
"""Retrieve a list of Sampling Feature objects.
367+
368+
If no arguments are passed to the function, or their values are None,
369+
all Sampling Feature objects in the database will be returned.
370+
371+
Args:
372+
ids (list, optional): List of SamplingFeatureIDs.
373+
codes (list, optional): List of SamplingFeature Codes.
374+
uuids (list, optional): List of UUIDs string.
375+
type (str, optional): Type of Sampling Feature from
376+
`controlled vocabulary name <http://vocabulary.odm2.org/samplingfeaturetype/>`_.
377+
wkt (str, optional): SamplingFeature Well Known Text.
378+
results (bool, optional): Whether or not you want to return only the
379+
sampling features that have results associated with them.
380+
381+
Returns:
382+
list: List of Sampling Feature objects
383+
384+
Examples:
385+
>>> READ = ReadODM2(SESSION_FACTORY)
386+
>>> READ.getSamplingFeatures(ids=[39, 40])
387+
>>> READ.getSamplingFeatures(codes=['HOME', 'FIELD'])
388+
>>> READ.getSamplingFeatures(uuids=['a6f114f1-5416-4606-ae10-23be32dbc202',
389+
... '5396fdf3-ceb3-46b6-aaf9-454a37278bb4'])
390+
>>> READ.getSamplingFeatures(type='Site')
391+
>>> READ.getSamplingFeatures(wkt='POINT (30 10)')
392+
>>> READ.getSamplingFeatures(results=True)
393+
>>> READ.getSamplingFeatures(type='Site', results=True)
394+
375395
"""
376396
if results:
377397
try:

0 commit comments

Comments
 (0)