optimisation calcul hash/validité geojson

This commit is contained in:
cquest 2016-11-20 10:58:16 +01:00
parent 268c270ac0
commit 071005528f

View file

@ -122,9 +122,9 @@ class EventResource(BaseEvent):
# get its id (md5 hash)
h = cur.fetchone()
if h is None:
cur.execute("""SELECT md5(st_asewkt(st_geomfromgeojson( %s ))),
ST_IsValid(st_geomfromgeojson( %s )),
ST_IsValidReason(st_geomfromgeojson( %s )) ;""", (geometry,geometry,geometry))
cur.execute("""SELECT md5(st_asewkt(geom)),
ST_IsValid(geom),
ST_IsValidReason(geom) from (SELECT st_geomfromgeojson( %s ) as geom) as g ;""", (geometry,))
h = cur.fetchone()
return h