本文整理汇总了Python中treemap.models.Plot.readonly方法的典型用法代码示例。如果您正苦于以下问题:Python Plot.readonly方法的具体用法?Python Plot.readonly怎么用?Python Plot.readonly使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类treemap.models.Plot
的用法示例。
在下文中一共展示了Plot.readonly方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: handle_row
# 需要导入模块: from treemap.models import Plot [as 别名]
# 或者: from treemap.models.Plot import readonly [as 别名]
def handle_row(self, row):
self.log_verbose(row)
# check the physical location
ok, x, y = self.check_coords(row)
if not ok: return
plot = Plot()
try:
if self.base_srid != 4326:
geom = Point(x, y, srid=self.base_srid)
geom.transform(self.tf)
self.log_verbose(geom)
plot.geometry = geom
else:
plot.geometry = Point(x, y, srid=4326)
except:
self.log_error("ERROR: Geometry failed to transform", row)
return
# check the species (if any)
ok, species = self.check_species(row)
if not ok: return
# check for tree info, should we create a tree or just a plot
if species or self.check_tree_info(row):
tree = Tree(plot=plot)
else:
tree = None
if tree and species:
tree.species = species[0]
# check the proximity (try to match up with existing trees)
# this may return a different plot/tree than created just above,
# so don't set anything else on either until after this point
ok, plot, tree = self.check_proximity(plot, tree, species, row)
if not ok: return
if row.get('ADDRESS') and not plot.address_street:
plot.address_street = str(row['ADDRESS']).title()
plot.geocoded_address = str(row['ADDRESS']).title()
if not plot.geocoded_address:
plot.geocoded_address = ""
# FIXME: get this from the config?
plot.address_state = 'CA'
plot.import_event = self.import_event
plot.last_updated_by = self.updater
plot.data_owner = self.data_owner
plot.readonly = self.readonly
if row.get('PLOTTYPE'):
for k, v in choices['plot_types']:
if v == row['PLOTTYPE']:
plot.type = k
break;
if row.get('PLOTLENGTH'):
plot.length = row['PLOTLENGTH']
if row.get('PLOTWIDTH'):
plot.width = row['PLOTWIDTH']
if row.get('ID'):
plot.owner_orig_id = row['ID']
if row.get('ORIGID'):
plot.owner_additional_properties = "ORIGID=" + str(row['ORIGID'])
if row.get('OWNER_ADDITIONAL_PROPERTIES'):
plot.owner_additional_properties = str(plot.owner_additional_properties) + " " + str(row['OWNER_ADDITIONAL_PROPERTIES'])
if row.get('OWNER_ADDITIONAL_ID'):
plot.owner_additional_id = str(row['OWNER_ADDITIONAL_ID'])
if row.get('POWERLINE'):
for k, v in choices['powerlines']:
if v == row['POWERLINE']:
plot.powerline_conflict_potential = k
break;
sidewalk_damage = row.get('SIDEWALK')
if sidewalk_damage is None or sidewalk_damage.strip() == "":
pass
elif sidewalk_damage is True or sidewalk_damage.lower() == "true" or sidewalk_damage.lower() == 'yes':
plot.sidewalk_damage = 2
else:
plot.sidewalk_damage = 1
plot.quick_save()
pnt = plot.geometry
n = Neighborhood.objects.filter(geometry__contains=pnt)
z = ZipCode.objects.filter(geometry__contains=pnt)
#.........这里部分代码省略.........
示例2: handle_row
# 需要导入模块: from treemap.models import Plot [as 别名]
# 或者: from treemap.models.Plot import readonly [as 别名]
def handle_row(self, row):
self.log_verbose(row)
# check the physical location
ok, x, y = self.check_coords(row)
if not ok:
return
plot = Plot()
try:
if self.base_srid != 4326:
geom = Point(x, y, srid=self.base_srid)
geom.transform(self.tf)
self.log_verbose(geom)
plot.geometry = geom
else:
plot.geometry = Point(x, y, srid=4326)
except:
self.log_error("ERROR: Geometry failed to transform", row)
return
# check the species (if any)
ok, species = self.check_species(row)
if not ok:
return
# check for tree info, should we create a tree or just a plot
if species or self.check_tree_info(row):
tree = Tree(plot=plot)
else:
tree = None
if tree and species:
tree.species = species[0]
# check the proximity (try to match up with existing trees)
# this may return a different plot/tree than created just above,
# so don't set anything else on either until after this point
ok, plot, tree = self.check_proximity(plot, tree, species, row)
if not ok:
return
if row.get("ADDRESS") and not plot.address_street:
plot.address_street = str(row["ADDRESS"]).title()
plot.geocoded_address = str(row["ADDRESS"]).title()
if not plot.geocoded_address:
plot.geocoded_address = ""
# FIXME: get this from the config?
plot.address_state = "CA"
plot.import_event = self.import_event
plot.last_updated_by = self.updater
plot.data_owner = self.data_owner
plot.readonly = self.readonly
if row.get("PLOTTYPE"):
for k, v in choices["plot_types"]:
if v == row["PLOTTYPE"]:
plot.type = k
break
if row.get("PLOTLENGTH"):
plot.length = row["PLOTLENGTH"]
if row.get("PLOTWIDTH"):
plot.width = row["PLOTWIDTH"]
if row.get("ID"):
plot.owner_orig_id = row["ID"]
if row.get("ORIGID"):
plot.owner_additional_properties = "ORIGID=" + str(row["ORIGID"])
if row.get("OWNER_ADDITIONAL_PROPERTIES"):
plot.owner_additional_properties = (
str(plot.owner_additional_properties) + " " + str(row["OWNER_ADDITIONAL_PROPERTIES"])
)
if row.get("OWNER_ADDITIONAL_ID"):
plot.owner_additional_id = str(row["OWNER_ADDITIONAL_ID"])
if row.get("POWERLINE"):
for k, v in choices["powerlines"]:
if v == row["POWERLINE"]:
plot.powerline = k
break
sidewalk_damage = row.get("SIDEWALK")
if sidewalk_damage is None or sidewalk_damage.strip() == "":
pass
elif sidewalk_damage is True or sidewalk_damage.lower() == "true" or sidewalk_damage.lower() == "yes":
plot.sidewalk_damage = 2
else:
plot.sidewalk_damage = 1
plot.quick_save()
pnt = plot.geometry
#.........这里部分代码省略.........