Exemple #1
0
def pgelement_adapter(obj, request):
    # In order to pass a geometry object to the pyramid json renderer
    # we have to pull the geometry and generate a python dict
    # Postgis's geojson function returns a string, so we have to pass
    # that to json loads in order for the final output to be correct.

    # FIXME, this method currently makes a query against the database
    # for each geometry
    s = DBSession()
    return json.loads(s.scalar(obj.geojson))
def pgelement_adapter(obj, request):
    # In order to pass a geometry object to the pyramid json renderer
    # we have to pull the geometry and generate a python dict
    # Postgis's geojson function returns a string, so we have to pass
    # that to json loads in order for the final output to be correct.

    # FIXME, this method currently makes a query against the database
    # for each geometry
    s = DBSession()
    return json.loads(s.scalar(obj.geojson))