gntools.plans module¶
Module that facilitates working with GEONIS Generalized Plans (GP or “Planwelt”).
-
class
gntools.plans.
PlanHelper
(plan, {workspace}, {user_prefix})¶ Helper class that returns proper names for Generalized Plan (GP or Planwelt) feature datasets, feature classes and field names. The generated names conform to the GEONIS conventions, i.e. if a plan name contains a number >= 1000, it is assumed that the plan is a custom user plan, which means that it will be prefixed with a U_.
Params:
plan (str, unicode):
GEONIS Generalized Plan (Planwelt) name. For user plans (where numeric part >= 1000), the U_ prefix can be omitted if the field names should not have this prefix.
workspace (str, unicode, gpf.paths.Workspace):
An optional Esri workspace path (
str
) or agpf.paths.Workspace
instance. When specified, theget_feature_class()
andget_feature_dataset()
functions will return full paths instead of just the names.
Keyword params:
user_prefix (str, unicode):
The prefix for custom user plans (where numeric part >= 1000). Defaults to U.
If you initialize the
PlanHelper
with a workspace, full paths will be returned:>>> gph = PlanHelper('pw3', r'C:/temp/test.gdb') >>> gph.get_feature_dataset('was') 'C:\temp\test.gdb\WAS_PW3' >>> gph.get_feature_class('sew', 'haltung') 'C:\temp\test.gdb\SEW_PW3\SEW_PW3_HALTUNG' >>> gph.get_feature_class('sew', 'awk_haltung') # note: you can include a prefix override! 'C:\temp\test.gdb\SEW_PW3\AWK_PW3_HALTUNG'
The following example shows how to use a
PlanHelper
for custom user plans (names only):>>> gph = PlanHelper('gp1000') >>> gph.get_feature_dataset('ELE') 'U_ELE_GP1000' >>> gph.get_feature_class('ele', 'cable') 'U_ELE_GP1000_CABLE'
-
abbreviation
¶ Returns the Generalized Plan abbreviation (e.g. “GP” or “PW”).
Return type: str
-
get_feature_class
(fds_base, fc_base)¶ Returns a feature class name for the current Generalized Plan/Planwelt.
Parameters: - fds_base – Case-insensitive base name (GEONIS Solution) of the parent feature dataset, e.g. ELE.
- fc_base – Case-insensitive base name of the feature class, e.g. (ELE_)KABEL. If fc_base already contains fds_base as a prefix, it will be replaced.
Return type: str, unicode
-
get_feature_dataset
(fds_base)¶ Returns a feature dataset name for the current Generalized Plan/Planwelt.
Parameters: fds_base – Case-insensitive base name (GEONIS Solution) of the feature dataset, e.g. ELE, WAS etc. Return type: str, unicode
-
number
¶ Returns the Generalized Plan number as a string (e.g. “1”, “2”, “1001” etc.).
Return type: str
-
prefix
¶ Returns the Generalized Plan user prefix including the separator (underscore), e.g.
U_
.Return type: str
-
workspace
¶ Returns the Workspace instance for this PlanHelper (specified on initialization).
Rtyoe: gpf.paths.Workspace