def to_json()

in geopointshape/_tools/parse.py [0:0]


def to_json(f):
  for line in f:
    try:
      point = json.loads(line)["location"]
      d = {}
      d["location"] = "POINT (" + str(point[0]) + " " + str(point[1]) + ")"
      print(json.dumps(d))
    except KeyboardInterrupt:
      break
    except Exception as e:
      print("Skipping malformed entry '%s' because of %s" %(line, str(e)), file=sys.stderr)