Skip to content

ROGUE-JCTD/django-gsschema

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Geoserver Schema

A service that allows users to upload/download the geoserver schema.xsd files associated with each layer. More specifically, gsschema is a Django application which uses the GeoServer rest api to retrieve the list of layers and then associate a layer with a schema file provided by the user. The schema.xsd file describes a featureType by listing all its attributs as well as the type associated with attribute. The GeoSHAPE project uses the schema file to specify the drop down choices for a given attribute as well as an optional way to indicate that a particular attribute should be populated using datetime picker in MapLoom (web client) and Arbiter (mobile client).It is an open-source application that has been developed under the ROGUE project and is part of the GeoSHAPE eco-system.

Notes

  • A "normal" schema can be defined as such:

Hospitals1

<?xml version="1.0" encoding="UTF-8"?><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:geonode="http://www.geonode.org/" xmlns:gml="http://www.opengis.net/gml" elementFormDefault="qualified" targetNamespace="http://www.geonode.org/">
  <xsd:import namespace="http://www.opengis.net/gml" schemaLocation="http://<VM IP Address>/geoserver/schemas/gml/3.1.1/base/gml.xsd"/>
  <xsd:complexType name="Hospitals1Type">
    <xsd:complexContent>
      <xsd:extension base="gml:AbstractFeatureType">
        <xsd:sequence>
          <xsd:element maxOccurs="1" minOccurs="0" name="geometry" nillable="true" type="gml:PointPropertyType"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="name" nillable="true" type="xsd:string"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="status" nillable="true">
            <xsd:simpleType>
              <xsd:restriction base="xsd:string">
                <xsd:enumeration value="open"/>
                <xsd:enumeration value="closed"/>
              </xsd:restriction>
            </xsd:simpleType>
          </xsd:element>
          <xsd:element maxOccurs="1" minOccurs="0" name="number_of_beds_available" nillable="true" type="xsd:long"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="number_of_beds_total" nillable="true" type="xsd:long"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="fotos" nillable="true" type="xsd:string"/>
        </xsd:sequence>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  <xsd:element name="Hospitals1" substitutionGroup="gml:_Feature" type="geonode:Hospitals1Type"/>
</xsd:schema>
  • The main lines that are going to be edited are the 'xsd:element' sections. Two changes are made to that line: first, the type="xsd:string"/> is replaced with just > then the choices are added and the emelemt tag is closed
    <xsd:simpleType>
      <xsd:restriction base="xsd:string">
        <xsd:enumeration value="open"/>
        <xsd:enumeration value="closed"/>
      </xsd:restriction>
    </xsd:simpleType>
  </xsd:element>
  • The attribute 'type' inside the 'xsd:element' has many options, such as the following:
    • 'xsd:date'
    • 'xsd:dateTime'
    • 'xsd:long'
    • 'xsd:string'
    • Any other supported 'xsd' type.

API Quick Guide

Since schemas are already created (and each layer is using their own respective schema on MapLoom), GSSchema gives the user the ability to edit any available schema. To start, you can log onto GSSchema:

The user must be logged into GeoSHAPE.

example: http://192.168.99.100/gsschema/

/gsschema/

You will be presented with a dropdown list, containing each layer that Geonode holds. One a layer is selected, a few action buttons will be presented. These buttons are listed in order of a normal use of GSSchema.

Describe FeatureType

This button will allow you to download the schema that is currently being used for the selected layer. After downloading the schema, any text editor can be used to edit the schema and be uploaded with the next button. Editing tips will be covered in this document.

Upload

Once a file is chosen for upload, this button will be enabled. This will upload the schema to Geoserver (while immediately reflecting on MapLoom) and make a local backup on the machine. This will then enable the Download and Remove buttons if it is successfully uploaded.

  • Expected results for upload:
    • Successful
    • Error Uploading: "Invalid file" (Non-XML format, not '.xsd')
    • Error Uploading: "Invalid schema"

Download

This button allows you to download a schema that you previously uploaded through /gsschema/. This schema is local to the machine, and if no schemas have been uploaded, this button will be disabled.

Remove

This will remove the currently selected layer's schema that is local to the machine. It will prompt the user with a window confirming if they want to remove the file. This button will be disabled if there is not a previous schema uploaded for that layer.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published