Fixed #25940 -- Added OGRGeometry.from_gml() and GEOSGeometry.from_gml().

This commit is contained in:
Sergey Fedoseev 2016-06-10 11:50:07 +05:00 committed by Tim Graham
parent 20d1cb33c2
commit 5ce660cd65
8 changed files with 44 additions and 1 deletions

View file

@ -52,6 +52,7 @@ from django.contrib.gis.gdal.prototypes import geom as capi, srs as srs_api
from django.contrib.gis.gdal.srs import CoordTransform, SpatialReference
from django.contrib.gis.geometry.regex import hex_regex, json_regex, wkt_regex
from django.utils import six
from django.utils.encoding import force_bytes
from django.utils.six.moves import range
@ -150,6 +151,10 @@ class OGRGeometry(GDALBase):
return OGRGeometry('POLYGON((%s %s, %s %s, %s %s, %s %s, %s %s))' % (
x0, y0, x0, y1, x1, y1, x1, y0, x0, y0))
@classmethod
def from_gml(cls, gml_string):
return cls(capi.from_gml(force_bytes(gml_string)))
# ### Geometry set-like operations ###
# g = g1 | g2
def __or__(self, other):