Avoid unneeded mapping/translation of rows
This commit is contained in:
@@ -29,13 +29,8 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$
|
|||||||
user_isolines_config = GD["user_mapzen_isolines_routing_config_{0}".format(username)]
|
user_isolines_config = GD["user_mapzen_isolines_routing_config_{0}".format(username)]
|
||||||
type = 'isodistance'
|
type = 'isodistance'
|
||||||
|
|
||||||
mapzen_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_mapzen_isolines($1, $2, $3, $4, $5, $6, $7) as isoline; ", ["text", "text", "text", "geometry(Geometry, 4326)", "text", "integer[]", "text[]"])
|
mapzen_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapzen_isolines($1, $2, $3, $4, $5, $6, $7) as isoline; ", ["text", "text", "text", "geometry(Geometry, 4326)", "text", "integer[]", "text[]"])
|
||||||
result = plpy.execute(mapzen_plan, [username, orgname, type, source, mode, range, options])
|
result = plpy.execute(mapzen_plan, [username, orgname, type, source, mode, range, options])
|
||||||
isolines = []
|
|
||||||
for element in result:
|
|
||||||
isoline = element['isoline']
|
|
||||||
isoline = isoline.translate(None, "()").split(',')
|
|
||||||
isolines.append(isoline)
|
|
||||||
|
|
||||||
return isolines
|
return result
|
||||||
$$ LANGUAGE plpythonu;
|
$$ LANGUAGE plpythonu;
|
||||||
|
|||||||
@@ -30,13 +30,8 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$
|
|||||||
user_isolines_config = GD["user_mapzen_isolines_routing_config_{0}".format(username)]
|
user_isolines_config = GD["user_mapzen_isolines_routing_config_{0}".format(username)]
|
||||||
type = 'isochrone'
|
type = 'isochrone'
|
||||||
|
|
||||||
mapzen_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_mapzen_isolines($1, $2, $3, $4, $5, $6, $7) as isoline; ", ["text", "text", "text", "geometry(Geometry, 4326)", "text", "integer[]", "text[]"])
|
mapzen_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapzen_isolines($1, $2, $3, $4, $5, $6, $7) as isoline; ", ["text", "text", "text", "geometry(Geometry, 4326)", "text", "integer[]", "text[]"])
|
||||||
result = plpy.execute(mapzen_plan, [username, orgname, type, source, mode, range, options])
|
result = plpy.execute(mapzen_plan, [username, orgname, type, source, mode, range, options])
|
||||||
isolines = []
|
|
||||||
for element in result:
|
|
||||||
isoline = element['isoline']
|
|
||||||
isoline = isoline.translate(None, "()").split(',') #--TODO what is this for?
|
|
||||||
isolines.append(isoline)
|
|
||||||
|
|
||||||
return isolines
|
return result
|
||||||
$$ LANGUAGE plpythonu;
|
$$ LANGUAGE plpythonu;
|
||||||
|
|||||||
Reference in New Issue
Block a user