class Glyph(models.Model): def __str__(self): return self.line.page.manuscript.accession_number + ( ', p. %i, l. %i, g. %i' % (self.line.page.number_in_manuscript, self.line.number_in_page, self.number_in_line)) line = models.ForeignKey(Line, on_delete=models.CASCADE) image = models.ImageField(blank=True) number_in_line = models.IntegerField("Sequence of glyph in line", default=0) number_in_page = models.IntegerField("Sequence of glyph in page", null=True, blank=True) # image_filename = models.CharField("Name of glyph image minus extension", max_length=300, default='') unicode_glyphs = models.CharField("Unicode hieroglyphs", max_length=50, blank=True) manuel_de_codage = models.CharField("Manuel de Codage hieroglyphs", max_length=100, blank=True) moller_number = models.CharField("Entry number in Möller's Palaeographie", max_length=50, blank=True) mainz_number = models.CharField("Entry number in Mainz Palaeographie", max_length=100, blank=True) # polygon = models.ForeignKey(Polygon, on_delete=models.CASCADE, null=True, blank=True) shape = models.LineStringField(blank=True, null=True) # objects = models.Manager() objects = RegionManager()
class Link(models.Model): """ Metadata is stored in a PostgreSQL HStore field, which allows us to store arbitrary key-value pairs with a link record. """ metadata = HStoreField(blank=True, null=True, default=dict) geo = models.LineStringField() objects = GeoManager()
class Lineas(models.Model): name = models.CharField(max_length=50) descripcion = models.TextField() geometry = models.LineStringField() objects = models.GeoManager() def __str__(self): return self.name
class Streets(models.Model): name = models.CharField(max_length=80) location = models.LineStringField(srid=4326) objects = models.GeoManager() def __str__(self): return self.name class Meta: verbose_name_plural = 'Streets'
class RouteChange(models.Model): route_id = models.TextField(primary_key=True) shape_id = models.TextField(blank=True, null=True) y2009_trip_count = models.IntegerField(blank=True, null=True) y2017_trip_count = models.IntegerField(blank=True, null=True) geom_linestring = models.LineStringField(blank=True, null=True) pct_change = models.FloatField(blank=True, null=True) class Meta: managed = False db_table = 'route_change' in_db = 'passenger_census'
class Line(models.Model): def __str__(self): return self.page.manuscript.accession_number + ( ', p. %i, l. %i' % (self.page.number_in_manuscript, self.number_in_page)) page = models.ForeignKey(Page, on_delete=models.CASCADE) image = models.ImageField(blank=True, null=True) number_in_page = models.IntegerField("Sequence of line in page", default=0) number_in_manuscript = models.IntegerField( "Sequence of line in manuscript as a whole", null=True) # image_filename = models.CharField("Name of line image minus extension", max_length=300, blank=True, default='') # polygon = models.ForeignKey(Polygon, on_delete=models.CASCADE, null=True, blank=True) shape = models.LineStringField(blank=True, null=True) # shape = models.IntegerField(null=True, default=0) objects = RegionManager()
class Way(OSM_Primitive): nodes = models.ManyToManyField('Node', through='WN', related_name="nodes_in_way") geom = models.LineStringField(blank=True, null=True) objects = GeoManager() def add_node(self, node): count = self.wn_set.count() if count == 0: wn = WN.objects.create(node=node, way=self, sequence=1) wn.save() else: node_sequences = self.wn_set.all() sequence_list = [] sequence = 0 for seq in node_sequences: sequence_list.append(seq.sequence) max_sequence_num = max(sequence_list) + 1 wn = WN.objects.create(node=node, way=self, sequence=max_sequence_num) wn.save() return wn def add_nodes_geom(self): way_nodes = self.nodes.all() nodes = [] for way_node in way_nodes: single_node_geom = list(way_node.geom) nodes.append(single_node_geom) self.geom = LineString(nodes) self.save()
class Edge(models.Model) : origin=models.ForeignKey(Node ,related_name='origin') destination = models.ForeignKey(Node, related_name='destination') line=models.LineStringField(srid=4326,null=True,blank=True) objects=models.GeoManager() def distance(self): if self.origin_id and self.destination_id: from parse_edges import distance return distance({ "lat": self.origin.location.x, "lon": self.origin.location.y }, { "lat": self.destination.location.x, "lon": self.destination.location.y }) def __unicode__(self): return "%s -> %s"%(self.origin.name,self.destination.name) def save(self,*args,**kwargs): if self.origin_id and self.destination_id: self.line = LineString(self.origin.location,self.destination.location) super(Edge,self).save(*args,**kwargs)
class Sentier(models.Model): name = models.CharField(max_length=50, blank=True) geom = models.LineStringField() objects = GeoManager()
class shapefile(models.Model): mpoly = models.LineStringField(null=True) object = models.Manager()
class Geomet(models.Model): mpoly = models.LineStringField(null=True) object = models.Manager()
class RoadCityCenter(models.Model): mpoly = models.LineStringField() name = models.CharField(max_length=500, null=True) object = models.Manager()
class LineStringMapFeature(MapFeature): geom = models.LineStringField(srid=4326)
class firewalls(models.Model): location = models.LineStringField(srid=3857) type = models.IntegerField() descript = models.CharField(max_length=70)