I have an Occurrence model, which is represented by a polygon, and has a one-to-many relationship to an attribute table. The models are stored in a PostGIS database.
class Occurrence(models.Model):
"""Model representing an archaeological occurrence within a site."""
designation = models.CharField(max_length=254)
bounding_polygon = models.PolygonField(null=True, blank=True)
#...
class AttributeOccurrence(models.Model):
"""Model representing an attribute of an occurrence."""
value = models.ForeignKey(AttributeChoice, on_delete=models.PROTECT)
occurrence = models.ForeignKey(Occurrence, on_delete=models.CASCADE)
I have created a Store in GeoServer to publish the layer for the Occurrences.
How can I associate these attributes that are in the table so that they can be visible through GeoServer?
You will need to use the application schema extension:
The application schema support (app-schema) extension provides support for Complex Features in GeoServer WFS.