Foirmeacha API GeodJangoLink to this heading

Soláthraíonn GeodJango roinnt réimsí foirme speisialaithe agus giuirléidí d'fhonn sonraí geolocálaithe a thaispeáint agus a chur in eagar ar léarscáil. De réir réamhshocraithe, úsáideann siad léarscáileanna OpenLayers faoi thiomáint, le bonn ciseal WMS a sholáthraíonn NASA.

Argóintí réimseLink to this heading

Chomh maith leis na rialt:ref: argóintí réimse foirm <core-field-arguments>, glacann réimsí foirme GeodJango na hargóintí roghnacha seo a leanas.

SridLink to this heading

Field.sridLink to this definition

Is é seo an cód SRID ar chóir luach an réimse a athrú. Mar shampla, má tá an giuirléid léarscáileanna SRID difriúil ón SRID a úsáideann d'fheidhmchlár nó do bhunachar sonraí níos ginearálta, tiontóidh an réimse luachanna ionchuir go huathoibríoch go SRID sin.

cineál_geomLink to this heading

Field.geom_typeLink to this definition

De ghnáth níor cheart go mbeadh ort an tréith sin a shocrú nó a athrú ar chóir a chur ar bun ag brath ar an rang allamuigh. Meaitseálann sé ainm geoiméadrach caighdeánach OpenGIS.

max_geom_collectionsLink to this heading

Field.max_geom_collectionsLink to this definition

The maximum number of geometry collections the field accepts before refusing to parse the input and raising a ValidationError. This guards against crashes in the underlying GEOS library when parsing deeply nested GEOMETRYCOLLECTION input. It defaults to 198.

The limit is applied differently depending on the input format: for well-known text (WKT) it bounds the nesting depth, while for well-known binary (WKB and hex-encoded WKB) it bounds the total number of geometry collections (both breadth and depth). As a result, the same value may accept a wide, shallow collection as WKT but reject it as WKB. For GeoJSON, the limit is not applied at all, since GDAL parses that input type instead.

Increase this value (or set to None) only if you must accept legitimately deep geometries, since doing so reduces protection against fatal errors.

Ranganna réimse foirmLink to this heading

Réimse GeoiméadraitheLink to this heading

class GeometryFieldLink to this definition

PointfieldLink to this heading

class PointFieldLink to this definition

LínestringfieldLink to this heading

class LineStringFieldLink to this definition

PolygonfieldLink to this heading

class PolygonFieldLink to this definition

Réimse IlphointLink to this heading

class MultiPointFieldLink to this definition

Páirc IllíneachLink to this heading

class MultiLineStringFieldLink to this definition

MultipolygonfieldLink to this heading

class MultiPolygonFieldLink to this definition

Réimse Bailiúcháin GeoimetrachLink to this heading

class GeometryCollectionFieldLink to this definition

Giuirléidí foirLink to this heading

Ligeann giuirléidí foirme GeodJango duit sonraí geografacha a thaispeáint agus a chur in eagar ar léarscáil amhairc Tabhair faoi deara nach dtacaíonn aon cheann de na giuirléidí atá ar fáil faoi láthair le geoiméadair 3D, mar sin tiocfaidh réimsí geoiméadachta siar ag úsáid giuirléid ``Textarea` le haghaidh sonraí den sórt

tréithe giuirléidLink to this heading

Tá giuirléidí GeodJango bunaithe ar theimpléad, mar sin tá a gcuid tréithe difriúil den chuid is mó ó thréithe giuirléid Django eile.

BaseGeometryWidget.base_layerLink to this definition

A string that specifies the identifier for the default base map layer to be used by the corresponding JavaScript map widget. It is passed as part of the widget options when rendering, allowing the MapWidget to determine which map tile provider or base layer to initialize (default is None).

BaseGeometryWidget.geom_typeLink to this definition

An cineál geoiméadracht OpenGIS, arna shocrú go ginearálta ag an réimse foirme.

BaseGeometryWidget.map_sridLink to this definition

Cód SRID a úsáideann an léarscáil (réamhshocraithe ná 4326).

BaseGeometryWidget.display_rawLink to this definition

Luach Boolean a shonraíonn an bhfuil ionchur textarea a thaispeánann léiriú sraitheach an ghéiméadracht reatha le feiceáil, go príomha chun críocha dífhabhtaithe (is é “False” réamhshocraithe).

BaseGeometryWidget.supports_3dLink to this definition

Léiríonn sé an dtacaíonn an giuirléid le eagrán sonraí 3D (réamhshocraithe ná False).

BaseGeometryWidget.template_nameLink to this definition

An teimpléad a úsáidtear chun an giuirléid léarscáil a

Is féidir leat tréithe giuirléid a rith ar an mbealach céanna le haghaidh aon ghuirléid Django eile. Mar shampla:

Code
from django.contrib.gis import forms


class MyGeoForm(forms.Form):
    point = forms.PointField(widget=forms.OSMWidget(attrs={"display_raw": True}))

Ranganna giuirléidLink to this heading

BasegeometryWidget

class BaseGeometryWidgetLink to this definition

This is an abstract base widget containing the logic needed by subclasses. You cannot directly use this widget for a geometry field. Note that the rendering of GeoDjango widgets is based on a base layer name, identified by the base_layer class attribute.

OpenLayersWidget

class OpenLayersWidgetLink to this definition

This is the default widget used by all GeoDjango form fields. Attributes are:

base_layerLink to this definition

nasaWorldview

template_nameLink to this definition

gis/openlayers.html.

map_sridLink to this definition

3857

OpenLayersWidget and OSMWidget include the ol.js and ol.css files hosted on the cdn.jsdelivr.net content-delivery network. These files can be overridden by subclassing the widget and setting the js and css properties of the inner Media class (see Sócmhainní mar shainiú statach).

OsmWidget

class OSMWidgetLink to this definition

This widget specialized OpenLayersWidget and uses an OpenStreetMap base layer to display geographic objects on. Attributes are:

base_layerLink to this definition

osm

default_latLink to this definition
default_lonLink to this definition

Is é an domhantead agus an domhanfhad lárnach réamhshocraithe 47 agus 5, faoi seach, atá ina suíomh in oirthear na Fraince.

default_zoomLink to this definition

Is é 12 an súmáil léarscáileanna réamhshocraithe.

The OpenLayersWidget note about using external assets also applies here. See also this FAQ answer about https access to map tiles.

Customizing the base layer used in OpenLayers-based widgetsLink to this heading

To customize the base layer displayed in OpenLayers-based geometry widgets, define a new layer builder in a custom JavaScript file. For example:

path-to-file.js
JavaScript
 MapWidget.layerBuilder.custom_layer_name = function () {
     // Return an OpenLayers layer instance.
     return new ol.layer.Tile({source: new ol.source.<ChosenSource>()});
 };

Then, subclass a standard geometry widget and set the base_layer:

Code
from django.contrib.gis.forms.widgets import OpenLayersWidget


class YourCustomWidget(OpenLayersWidget):
    base_layer = "custom_layer_name"

    class Media:
        js = ["path-to-file.js"]