Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix sip API reseting to version 1 (fixes PyQgs* tests currently faili…
…ng due to reset)
  • Loading branch information
dakcarto committed Sep 25, 2013
1 parent a17787b commit 8b6d813
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions python/__init__.py
Expand Up @@ -24,8 +24,6 @@
__revision__ = '$Format:%H$'

import sip
from qgis.core import QgsFeature, QgsGeometry

try:
apis = ["QDate", "QDateTime", "QString", "QTextStream", "QTime", "QUrl", "QVariant"]
for api in apis:
Expand All @@ -34,6 +32,8 @@
# API has already been set so we can't set it again.
pass

from qgis.core import QgsFeature, QgsGeometry

try:
# Add a __nonzero__ method onto QPyNullVariant so we can check for null values easier.
# >>> value = QPyNullVariant("int")
Expand Down Expand Up @@ -72,15 +72,15 @@ def mapping_feature(feature):
properties = {}
fields = [field.name() for field in feature.fields()]
properties = dict(zip(fields, feature.attributes()))
return {
return {
'type' : 'Feature',
'properties' : properties,
'geometry' : geom.__geo_interface__}

def mapping_geometry(geometry):
geo = geometry.exportToGeoJSON()
# We have to use eval because exportToGeoJSON() gives us
# back a string that looks like a dictionary.
# back a string that looks like a dictionary.
return eval(geo)

QgsFeature.__geo_interface__ = property(mapping_feature)
Expand Down

0 comments on commit 8b6d813

Please sign in to comment.