misc/shp_normalizer.py in cartodb-importer-0.2.3 vs misc/shp_normalizer.py in cartodb-importer-0.2.4
- old
+ new
@@ -13,10 +13,11 @@
name = sys.argv[2]
dbf_file = shp_file[0:-4] + '.dbf'
prj_file = shp_file[0:-4] + '.prj'
+srid = 4326
#Try detecting the SRID
if os.path.isfile(prj_file):
prj_filef = open(prj_file, 'r')
prj_txt = prj_filef.read()
prj_filef.close()
@@ -35,11 +36,11 @@
'terms' : prj_txt})
webres = urlopen('http://prj2epsg.org/search.json', query)
jres = json.loads(webres.read())
if jres['codes']:
srid = int(jres['codes'][0]['code'])
-
+
#Try to detect the encoding
dbf = open(dbf_file, 'rb')
db = dbfUtils.dbfreader(dbf)
detector = UniversalDetector()
@@ -51,6 +52,6 @@
encoding = detector.result["encoding"]
if encoding=="ascii":
encoding="LATIN1"
-print " -r %s -s 4326 -e -i -I -g the_geom -W %s %s %s" %(srid,encoding,shp_file,name)
+print "%s,%s,%s,%s" % (srid,encoding,shp_file,name)