12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- import os
- import sys
- import json
- import utilsgis
- import utils
- import log
- import importlib, sys
- importlib.reload(sys)
- def run(fun, data):
- try:
- eval("{0}".format(fun))(data)
-
- print("####OK####")
- except:
- msg = str(sys.exc_info()).decode('string-escape')
- print("####ERROR####" + msg)
- log.error(msg)
- def shp2geojson(data):
- shpfile = data["shpfile"]
- geojson = data["geojson"]
- utilsgis.shp2geojson(shpfile, geojson)
- def esriJson2shp(data):
- jsonfile = data["json"]
- shpfile = data["shpfile"]
- utilsgis.esriJson2shp(jsonfile, shpfile)
- def esriJson2sde(data):
- jsonfile = data["json"]
- shpfile = data["table"]
- utilsgis.esriJson2sde(jsonfile, shpfile)
- def shp2sde(data):
- shpfile = data["shpfile"]
- table = data["table"]
- fields = None
- if data.get('fields') != None:
- fields = data["fields"];
- utilsgis.shp2sde(shpfile, table, fields)
- def sde2shp(data):
- table = data["table"]
- where = data["where"]
- shpfile = data["shpfile"]
- utilsgis.sde2shp(table, shpfile, where)
- def dwgToShp(data):
- dwgfile = data["dwgfile"]
- espg = data["espg"]
- utilsgis.dwg2shp(dwgfile, espg)
- if __name__ == '__main__':
-
-
-
-
-
-
-
-
- if len(sys.argv) == 3:
- fun = sys.argv[1]
- jsonData = utils.b64Decode(sys.argv[2])
- log.info(jsonData)
- run(fun, json.loads(jsonData))
|