desc stringlengths 3 26.7k | decl stringlengths 11 7.89k | bodies stringlengths 8 553k |
|---|---|---|
'Returns the DE-9IM intersection matrix for this Geometry and the other.'
| def relate(self, other):
| return capi.geos_relate(self.ptr, other.ptr)
|
'Returns the Geometry, simplified using the Douglas-Peucker algorithm
to the specified tolerance (higher tolerance => less points). If no
tolerance provided, defaults to 0.
By default, this function does not preserve topology - e.g. polygons can
be split, collapse to lines or disappear holes can be created or
disappea... | def simplify(self, tolerance=0.0, preserve_topology=False):
| if preserve_topology:
return self._topology(capi.geos_preservesimplify(self.ptr, tolerance))
else:
return self._topology(capi.geos_simplify(self.ptr, tolerance))
|
'Returns a set combining the points in this Geometry not in other,
and the points in other not in this Geometry.'
| def sym_difference(self, other):
| return self._topology(capi.geos_symdifference(self.ptr, other.ptr))
|
'Returns a Geometry representing all the points in this Geometry and other.'
| def union(self, other):
| return self._topology(capi.geos_union(self.ptr, other.ptr))
|
'Returns the area of the Geometry.'
| @property
def area(self):
| return capi.geos_area(self.ptr, byref(c_double()))
|
'Returns the distance between the closest points on this Geometry
and the other. Units will be in those of the coordinate system of
the Geometry.'
| def distance(self, other):
| if (not isinstance(other, GEOSGeometry)):
raise TypeError('distance() works only on other GEOS Geometries.')
return capi.geos_distance(self.ptr, other.ptr, byref(c_double()))
|
'Returns the extent of this geometry as a 4-tuple, consisting of
(xmin, ymin, xmax, ymax).'
| @property
def extent(self):
| env = self.envelope
if isinstance(env, Point):
(xmin, ymin) = env.tuple
(xmax, ymax) = (xmin, ymin)
else:
(xmin, ymin) = env[0][0]
(xmax, ymax) = env[0][2]
return (xmin, ymin, xmax, ymax)
|
'Returns the length of this Geometry (e.g., 0 for point, or the
circumfrence of a Polygon).'
| @property
def length(self):
| return capi.geos_length(self.ptr, byref(c_double()))
|
'Clones this Geometry.'
| def clone(self):
| return GEOSGeometry(capi.geom_clone(self.ptr), srid=self.srid)
|
'Returns a _pointer_ to C GEOS Geometry object from the given WKB.'
| def read(self, wkb):
| if isinstance(wkb, buffer):
wkb_s = str(wkb)
return wkb_reader_read(self.ptr, wkb_s, len(wkb_s))
elif isinstance(wkb, basestring):
return wkb_reader_read_hex(self.ptr, wkb, len(wkb))
else:
raise TypeError
|
'Returns the WKT representation of the given geometry.'
| def write(self, geom):
| return wkt_writer_write(self.ptr, geom.ptr)
|
'Returns the WKB representation of the given geometry.'
| def write(self, geom):
| return buffer(wkb_writer_write(self.ptr, geom.ptr, byref(c_size_t())))
|
'Returns the HEXEWKB representation of the given geometry.'
| def write_hex(self, geom):
| return wkb_writer_write_hex(self.ptr, geom.ptr, byref(c_size_t()))
|
'Initializes a Geometry Collection from a sequence of Geometry objects.'
| def __init__(self, *args, **kwargs):
| if (not args):
raise TypeError(('Must provide at least one Geometry to initialize %s.' % self.__class__.__name__))
if (len(args) == 1):
if isinstance(args[0], (tuple, list)):
init_geoms = args[0]
else:
init_geoms = args
else:
in... |
'Iterates over each Geometry in the Collection.'
| def __iter__(self):
| for i in xrange(len(self)):
(yield self[i])
|
'Returns the number of geometries in this Collection.'
| def __len__(self):
| return self.num_geom
|
'Returns the Geometry from this Collection at the given index (0-based).'
| def _get_single_external(self, index):
| return GEOSGeometry(capi.geom_clone(self._get_single_internal(index)), srid=self.srid)
|
'Create a new collection, and destroy the contents of the previous pointer.'
| def _set_list(self, length, items):
| prev_ptr = self.ptr
srid = self.srid
self.ptr = self._create_collection(length, items)
if srid:
self.srid = srid
capi.destroy_geom(prev_ptr)
|
'Returns the KML for this Geometry Collection.'
| @property
def kml(self):
| return ('<MultiGeometry>%s</MultiGeometry>' % ''.join([g.kml for g in self]))
|
'Returns a tuple of all the coordinates in this Geometry Collection'
| @property
def tuple(self):
| return tuple([g.tuple for g in self])
|
'Returns a LineString representing the line merge of this
MultiLineString.'
| @property
def merged(self):
| return self._topology(capi.geos_linemerge(self.ptr))
|
'Returns a cascaded union of this MultiPolygon.'
| @property
def cascaded_union(self):
| if GEOS_PREPARE:
return GEOSGeometry(capi.geos_cascaded_union(self.ptr), self.srid)
else:
raise GEOSException('The cascaded union operation requires GEOS 3.1+.')
|
'The Point object may be initialized with either a tuple, or individual
parameters.
For Example:
>>> p = Point((5, 23)) # 2D point, passed in as a tuple
>>> p = Point(5, 23, 8) # 3D point, passed in with individual parameters'
| def __init__(self, x, y=None, z=None, srid=None):
| if isinstance(x, (tuple, list)):
ndim = len(x)
coords = x
elif (isinstance(x, (int, float, long)) and isinstance(y, (int, float, long))):
if isinstance(z, (int, float, long)):
ndim = 3
coords = [x, y, z]
else:
ndim = 2
coords = [x, ... |
'Create a coordinate sequence, set X, Y, [Z], and create point'
| def _create_point(self, ndim, coords):
| if ((ndim < 2) or (ndim > 3)):
raise TypeError(('Invalid point dimension: %s' % str(ndim)))
cs = capi.create_cs(c_uint(1), c_uint(ndim))
i = iter(coords)
capi.cs_setx(cs, 0, i.next())
capi.cs_sety(cs, 0, i.next())
if (ndim == 3):
capi.cs_setz(cs, 0, i.next())
return ... |
'Allows iteration over coordinates of this Point.'
| def __iter__(self):
| for i in xrange(len(self)):
(yield self[i])
|
'Returns the number of dimensions for this Point (either 0, 2 or 3).'
| def __len__(self):
| if self.empty:
return 0
if self.hasz:
return 3
else:
return 2
|
'Returns the X component of the Point.'
| def get_x(self):
| return self._cs.getOrdinate(0, 0)
|
'Sets the X component of the Point.'
| def set_x(self, value):
| self._cs.setOrdinate(0, 0, value)
|
'Returns the Y component of the Point.'
| def get_y(self):
| return self._cs.getOrdinate(1, 0)
|
'Sets the Y component of the Point.'
| def set_y(self, value):
| self._cs.setOrdinate(1, 0, value)
|
'Returns the Z component of the Point.'
| def get_z(self):
| if self.hasz:
return self._cs.getOrdinate(2, 0)
else:
return None
|
'Sets the Z component of the Point.'
| def set_z(self, value):
| if self.hasz:
self._cs.setOrdinate(2, 0, value)
else:
raise GEOSException('Cannot set Z on 2D Point.')
|
'Returns a tuple of the point.'
| def get_coords(self):
| return self._cs.tuple
|
'Sets the coordinates of the point with the given tuple.'
| def set_coords(self, tup):
| self._cs[0] = tup
|
'Get the item(s) at the specified index/slice.'
| def __getitem__(self, index):
| if isinstance(index, slice):
return [self._get_single_external(i) for i in xrange(*index.indices(len(self)))]
else:
index = self._checkindex(index)
return self._get_single_external(index)
|
'Delete the item(s) at the specified index/slice.'
| def __delitem__(self, index):
| if (not isinstance(index, (int, long, slice))):
raise TypeError(('%s is not a legal index' % index))
origLen = len(self)
if isinstance(index, (int, long)):
index = self._checkindex(index)
indexRange = [index]
else:
indexRange = range(*index.indices(origLen)... |
'Set the item(s) at the specified index/slice.'
| def __setitem__(self, index, val):
| if isinstance(index, slice):
self._set_slice(index, val)
else:
index = self._checkindex(index)
self._check_allowed((val,))
self._set_single(index, val)
|
'Iterate over the items in the list'
| def __iter__(self):
| for i in xrange(len(self)):
(yield self[i])
|
'add another list-like object'
| def __add__(self, other):
| return self.__class__((list(self) + list(other)))
|
'add to another list-like object'
| def __radd__(self, other):
| return other.__class__((list(other) + list(self)))
|
'add another list-like object to self'
| def __iadd__(self, other):
| self.extend(list(other))
return self
|
'multiply'
| def __mul__(self, n):
| return self.__class__((list(self) * n))
|
'multiply'
| def __rmul__(self, n):
| return self.__class__((list(self) * n))
|
'multiply'
| def __imul__(self, n):
| if (n <= 0):
del self[:]
else:
cache = list(self)
for i in range((n - 1)):
self.extend(cache)
return self
|
'cmp'
| def __cmp__(self, other):
| slen = len(self)
for i in range(slen):
try:
c = cmp(self[i], other[i])
except IndexError:
return 1
else:
if c:
return c
return cmp(slen, len(other))
|
'Standard list count method'
| def count(self, val):
| count = 0
for i in self:
if (val == i):
count += 1
return count
|
'Standard list index method'
| def index(self, val):
| for i in xrange(0, len(self)):
if (self[i] == val):
return i
raise ValueError(('%s not found in object' % str(val)))
|
'Standard list append method'
| def append(self, val):
| self[len(self):] = [val]
|
'Standard list extend method'
| def extend(self, vals):
| self[len(self):] = vals
|
'Standard list insert method'
| def insert(self, index, val):
| if (not isinstance(index, (int, long))):
raise TypeError(('%s is not a legal index' % index))
self[index:index] = [val]
|
'Standard list pop method'
| def pop(self, index=(-1)):
| result = self[index]
del self[index]
return result
|
'Standard list remove method'
| def remove(self, val):
| del self[self.index(val)]
|
'Standard list reverse method'
| def reverse(self):
| self[:] = self[(-1)::(-1)]
|
'Standard list sort method'
| def sort(self, cmp=cmp, key=None, reverse=False):
| if key:
temp = [(key(v), v) for v in self]
temp.sort(cmp=cmp, key=(lambda x: x[0]), reverse=reverse)
self[:] = [v[1] for v in temp]
else:
temp = list(self)
temp.sort(cmp=cmp, reverse=reverse)
self[:] = temp
|
'Assign values to a slice of the object'
| def _set_slice(self, index, values):
| try:
iter(values)
except TypeError:
raise TypeError('can only assign an iterable to a slice')
self._check_allowed(values)
origLen = len(self)
valueList = list(values)
(start, stop, step) = index.indices(origLen)
if (index.step is None):
self._assi... |
'Assign an extended slice by rebuilding entire list'
| def _assign_extended_slice_rebuild(self, start, stop, step, valueList):
| indexList = range(start, stop, step)
if (len(valueList) != len(indexList)):
raise ValueError(('attempt to assign sequence of size %d to extended slice of size %d' % (len(valueList), len(indexList))))
newLen = len(self)
newVals = dict(zip(indexList, valueList))... |
'Assign an extended slice by re-assigning individual items'
| def _assign_extended_slice(self, start, stop, step, valueList):
| indexList = range(start, stop, step)
if (len(valueList) != len(indexList)):
raise ValueError(('attempt to assign sequence of size %d to extended slice of size %d' % (len(valueList), len(indexList))))
for (i, val) in zip(indexList, valueList):
self._set_sin... |
'Assign a simple slice; Can assign slice of any length'
| def _assign_simple_slice(self, start, stop, valueList):
| origLen = len(self)
stop = max(start, stop)
newLen = (((origLen - stop) + start) + len(valueList))
def newItems():
for i in xrange((origLen + 1)):
if (i == start):
for val in valueList:
(yield val)
if (i < origLen):
if (... |
'Return the unit value and the default units specified
from the given keyword arguments dictionary.'
| def default_units(self, kwargs):
| val = 0.0
for (unit, value) in kwargs.iteritems():
if (not isinstance(value, float)):
value = float(value)
if (unit in self.UNITS):
val += (self.UNITS[unit] * value)
default_unit = unit
elif (unit in self.ALIAS):
u = self.ALIAS[unit]
... |
'Retrieves the unit attribute name for the given unit string.
For example, if the given unit string is \'metre\', \'m\' would be returned.
An exception is raised if an attribute cannot be found.'
| @classmethod
def unit_attname(cls, unit_str):
| lower = unit_str.lower()
if (unit_str in cls.UNITS):
return unit_str
elif (lower in cls.UNITS):
return lower
elif (lower in cls.LALIAS):
return cls.LALIAS[lower]
else:
raise Exception(('Could not find a unit keyword associated with "%s"' % unit... |
'Initializes the Google Zoom object.'
| def __init__(self, num_zoom=19, tilesize=256):
| self._tilesize = tilesize
self._nzoom = num_zoom
self._degpp = []
self._radpp = []
self._npix = []
z = tilesize
for i in xrange(num_zoom):
self._degpp.append((z / 360.0))
self._radpp.append((z / (2 * pi)))
self._npix.append((z / 2))
z *= 2
|
'Returns the number of zoom levels.'
| def __len__(self):
| return self._nzoom
|
'Unpacks longitude, latitude from GEOS Points and 2-tuples.'
| def get_lon_lat(self, lonlat):
| if isinstance(lonlat, Point):
(lon, lat) = lonlat.coords
else:
(lon, lat) = lonlat
return (lon, lat)
|
'Converts a longitude, latitude coordinate pair for the given zoom level.'
| def lonlat_to_pixel(self, lonlat, zoom):
| (lon, lat) = self.get_lon_lat(lonlat)
npix = self._npix[zoom]
px_x = round((npix + (lon * self._degpp[zoom])))
fac = min(max(sin((DTOR * lat)), (-0.9999)), 0.9999)
px_y = round((npix + ((0.5 * log(((1 + fac) / (1 - fac)))) * ((-1.0) * self._radpp[zoom]))))
return (px_x, px_y)
|
'Converts a pixel to a longitude, latitude pair at the given zoom level.'
| def pixel_to_lonlat(self, px, zoom):
| if (len(px) != 2):
raise TypeError('Pixel should be a sequence of two elements.')
npix = self._npix[zoom]
lon = ((px[0] - npix) / self._degpp[zoom])
lat = (RTOD * ((2 * atan(exp(((px[1] - npix) / ((-1.0) * self._radpp[zoom]))))) - (0.5 * pi)))
return (lon, lat)
|
'Returns a Polygon corresponding to the region represented by a fictional
Google Tile for the given longitude/latitude pair and zoom level. This
tile is used to determine the size of a tile at the given point.'
| def tile(self, lonlat, zoom):
| delta = (self._tilesize / 2)
px = self.lonlat_to_pixel(lonlat, zoom)
ll = self.pixel_to_lonlat(((px[0] - delta), (px[1] - delta)), zoom)
ur = self.pixel_to_lonlat(((px[0] + delta), (px[1] + delta)), zoom)
return Polygon(LinearRing(ll, (ll[0], ur[1]), ur, (ur[0], ll[1]), ll), srid=4326)
|
'Returns the optimal Zoom level for the given geometry.'
| def get_zoom(self, geom):
| if ((not isinstance(geom, GEOSGeometry)) or (geom.srid != 4326)):
raise TypeError('get_zoom() expects a GEOS Geometry with an SRID of 4326.')
env = geom.envelope
(env_w, env_h) = self.get_width_height(env.extent)
center = env.centroid
for z in xrange(self._nzoom):
... |
'Returns the width and height for the given extent.'
| def get_width_height(self, extent):
| ll = Point(extent[:2])
ul = Point(extent[0], extent[3])
ur = Point(extent[2:])
height = ll.distance(ul)
width = ul.distance(ur)
return (width, height)
|
'Initializes a GEvent object.
Parameters:
event:
string for the event, such as \'click\'. The event must be a valid
event for the object in the Google Maps API.
There is no validation of the event type within Django.
action:
string containing a Javascript function, such as
\'function() { location.href = "newurl";}\'
Th... | def __init__(self, event, action):
| self.event = event
self.action = action
|
'Returns the parameter part of a GEvent.'
| def __unicode__(self):
| return mark_safe(('"%s", %s' % (self.event, self.action)))
|
'Generates a JavaScript array of GLatLng objects for the given coordinates.'
| def latlng_from_coords(self, coords):
| return ('[%s]' % ','.join([('new GLatLng(%s,%s)' % (y, x)) for (x, y) in coords]))
|
'Attaches a GEvent to the overlay object.'
| def add_event(self, event):
| self.events.append(event)
|
'The string representation is the JavaScript API call.'
| def __unicode__(self):
| return mark_safe(('%s(%s)' % (self.__class__.__name__, self.js_params)))
|
'The GPolygon object initializes on a GEOS Polygon or a parameter that
may be instantiated into GEOS Polygon. Please note that this will not
depict a Polygon\'s internal rings.
Keyword Options:
stroke_color:
The color of the polygon outline. Defaults to \'#0000ff\' (blue).
stroke_weight:
The width of the polygon outli... | def __init__(self, poly, stroke_color='#0000ff', stroke_weight=2, stroke_opacity=1, fill_color='#0000ff', fill_opacity=0.4):
| if isinstance(poly, basestring):
poly = fromstr(poly)
if isinstance(poly, (tuple, list)):
poly = Polygon(poly)
if (not isinstance(poly, Polygon)):
raise TypeError('GPolygon may only initialize on GEOS Polygons.')
self.envelope = poly.envelope
self.points = s... |
'The GPolyline object may be initialized on GEOS LineStirng, LinearRing,
and Polygon objects (internal rings not supported) or a parameter that
may instantiated into one of the above geometries.
Keyword Options:
color:
The color to use for the polyline. Defaults to \'#0000ff\' (blue).
weight:
The width of the polyline... | def __init__(self, geom, color='#0000ff', weight=2, opacity=1):
| if isinstance(geom, basestring):
geom = fromstr(geom)
if isinstance(geom, (tuple, list)):
geom = Polygon(geom)
if isinstance(geom, (LineString, LinearRing)):
self.latlngs = self.latlng_from_coords(geom.coords)
elif isinstance(geom, Polygon):
self.latlngs = self.latlng_fro... |
'The GMarker object may initialize on GEOS Points or a parameter
that may be instantiated into a GEOS point. Keyword options map to
GMarkerOptions -- so far only the title option is supported.
Keyword Options:
title:
Title option for GMarker, will be displayed as a tooltip.
draggable:
Draggable option for GMarker, dis... | def __init__(self, geom, title=None, draggable=False, icon=None):
| if isinstance(geom, basestring):
geom = fromstr(geom)
if isinstance(geom, (tuple, list)):
geom = Point(geom)
if isinstance(geom, Point):
self.latlng = self.latlng_from_coords(geom.coords)
else:
raise TypeError('GMarker may only initialize on GEOS Point ... |
'Generates the JavaScript necessary for displaying this Google Map.'
| def render(self):
| params = {'calc_zoom': self.calc_zoom, 'center': self.center, 'dom_id': self.dom_id, 'js_module': self.js_module, 'kml_urls': self.kml_urls, 'zoom': self.zoom, 'polygons': self.polygons, 'polylines': self.polylines, 'icons': self.icons, 'markers': self.markers}
params.update(self.extra_context)
return rende... |
'Returns HTML body tag for loading and unloading Google Maps javascript.'
| @property
def body(self):
| return mark_safe(('<body %s %s>' % (self.onload, self.onunload)))
|
'Returns the `onload` HTML <body> attribute.'
| @property
def onload(self):
| return mark_safe(('onload="%s.%s_load()"' % (self.js_module, self.dom_id)))
|
'Returns the <script> tag for the Google Maps API javascript.'
| @property
def api_script(self):
| return mark_safe(('<script src="%s%s" type="text/javascript"></script>' % (self.api_url, self.key)))
|
'Returns only the generated Google Maps JavaScript (no <script> tags).'
| @property
def js(self):
| return self.render()
|
'Returns all <script></script> tags required with Google Maps JavaScript.'
| @property
def scripts(self):
| return mark_safe(('%s\n <script type="text/javascript">\n//<![CDATA[\n%s//]]>\n </script>' % (self.api_script, self.js)))
|
'Returns additional CSS styling needed for Google Maps on IE.'
| @property
def style(self):
| return mark_safe(('<style type="text/css">%s</style>' % self.vml_css))
|
'Returns XHTML information needed for IE VML overlays.'
| @property
def xhtml(self):
| return mark_safe(('<html xmlns="http://www.w3.org/1999/xhtml" %s>' % self.xmlns))
|
'Returns a sequence of GIcon objects in this map.'
| @property
def icons(self):
| return set([marker.icon for marker in self.markers if marker.icon])
|
'A class for generating sets of Google Maps that will be shown on the
same page together.
Example:
gmapset = GoogleMapSet( GoogleMap( ... ), GoogleMap( ... ) )
gmapset = GoogleMapSet( [ gmap1, gmap2] )'
| def __init__(self, *args, **kwargs):
| template = kwargs.pop('template', 'gis/google/google-multi.js')
self.map_template = kwargs.pop('map_template', 'gis/google/google-single.js')
super(GoogleMapSet, self).__init__(**kwargs)
self.template = template
if isinstance(args[0], (tuple, list)):
self.maps = args[0]
else:
sel... |
'Returns JavaScript containing all of the loading routines for each
map in this set.'
| def load_map_js(self):
| result = []
for (dom_id, gmap) in zip(self.dom_ids, self.maps):
tmp = (gmap.template, gmap.dom_id)
gmap.template = self.map_template
gmap.dom_id = dom_id
result.append(gmap.js)
(gmap.template, gmap.dom_id) = tmp
return mark_safe(''.join(result))
|
'Generates the JavaScript for the collection of Google Maps in
this set.'
| def render(self):
| params = {'js_module': self.js_module, 'dom_ids': self.dom_ids, 'load_map_js': self.load_map_js(), 'icons': self.icons}
params.update(self.extra_context)
return render_to_string(self.template, params)
|
'Returns the `onload` HTML <body> attribute.'
| @property
def onload(self):
| return mark_safe(('onload="%s.load()"' % self.js_module))
|
'Returns a sequence of all icons in each map of the set.'
| @property
def icons(self):
| icons = set()
for map in self.maps:
icons |= map.icons
return icons
|
'Goes through the given sources and returns a 3-tuple of
the application label, module name, and field name of every
GeometryField encountered in the sources.
If no sources are provided, then all models.'
| def _build_kml_sources(self, sources):
| kml_sources = []
if (sources is None):
sources = models.get_models()
for source in sources:
if isinstance(source, models.base.ModelBase):
for field in source._meta.fields:
if isinstance(field, GeometryField):
kml_sources.append((source._meta.ap... |
'This method is overrridden so the appropriate `geo_format` attribute
is placed on each URL element.'
| def get_urls(self, page=1, site=None):
| urls = Sitemap.get_urls(self, page=page, site=site)
for url in urls:
url['geo_format'] = self.geo_format
return urls
|
'This sitemap object initializes on a feed dictionary (as would be passed
to `django.contrib.syndication.views.feed`) and a slug dictionary.
If the slug dictionary is not defined, then it\'s assumed the keys provide
the URL parameter to the feed. However, if you have a complex feed (e.g.,
you override `get_object`, th... | def __init__(self, feed_dict, slug_dict=None):
| self.feed_dict = feed_dict
self.locations = []
if (slug_dict is None):
slug_dict = {}
for section in feed_dict.keys():
if slug_dict.get(section, False):
for slug in slug_dict[section]:
self.locations.append(('%s/%s' % (section, slug)))
else:
... |
'This method is overrridden so the appropriate `geo_format` attribute
is placed on each URL element.'
| def get_urls(self, page=1, site=None):
| urls = Sitemap.get_urls(self, page=page, site=site)
for url in urls:
url['geo_format'] = 'georss'
return urls
|
'In GeoRSS coordinate pairs are ordered by lat/lon and separated by
a single white space. Given a tuple of coordinates, this will return
a unicode GeoRSS representation.'
| def georss_coords(self, coords):
| return u' '.join([(u'%f %f' % (coord[1], coord[0])) for coord in coords])
|
'Adds a GeoRSS point with the given coords using the given handler.
Handles the differences between simple GeoRSS and the more pouplar
W3C Geo specification.'
| def add_georss_point(self, handler, coords, w3c_geo=False):
| if w3c_geo:
(lon, lat) = coords[:2]
handler.addQuickElement(u'geo:lat', (u'%f' % lat))
handler.addQuickElement(u'geo:lon', (u'%f' % lon))
else:
handler.addQuickElement(u'georss:point', self.georss_coords((coords,)))
|
'This routine adds a GeoRSS XML element using the given item and handler.'
| def add_georss_element(self, handler, item, w3c_geo=False):
| geom = item.get('geometry', None)
if (not (geom is None)):
if isinstance(geom, (list, tuple)):
box_coords = None
if isinstance(geom[0], (list, tuple)):
if (len(geom) == 2):
box_coords = geom
else:
raise Value... |
'Figures out the correct OGR Type based upon the input.'
| def __init__(self, type_input):
| if isinstance(type_input, OGRGeomType):
num = type_input.num
elif isinstance(type_input, basestring):
type_input = type_input.lower()
if (type_input == 'geometry'):
type_input = 'unknown'
num = self._str_types.get(type_input, None)
if (num is None):
... |
'Returns the value of the name property.'
| def __str__(self):
| return self.name
|
'Does an equivalence test on the OGR type with the given
other OGRGeomType, the short-hand string, or the integer.'
| def __eq__(self, other):
| if isinstance(other, OGRGeomType):
return (self.num == other.num)
elif isinstance(other, basestring):
return (self.name.lower() == other.lower())
elif isinstance(other, int):
return (self.num == other)
else:
return False
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.