|
POST
|
Our main goal though is to go from the TIFFS straight to the Mosaic dataset if possible
... View more
02-26-2020
01:27 PM
|
0
|
0
|
2568
|
|
POST
|
import os, cx_Oracle, string, datetime, time
import arcgisscripting,arcpy
import shutil
class PlateMapGeneration:
pass
user = ''
sdeusr = ''
fldr = ''
path = ''
asset_path = ''
sde = ''
projection = ''
connect_string = ''
timestamp_d = ''
timestamp_t = ''
filelist = []
maplist = []
local_path = ''
final_path = ''
temp_table_conn = ''
sde_conn = ''
plates_gis = ''
def start_process(self, username_, ************_, ************_, sde_, db_):
global user
global *************
global **********
global path
global asset_path
global sde
global connect_string
global timestamp_d
global timestamp_t
global projection
global local_path
global final_path
global sde_conn
global plates_gis
user = username_
*********** = ***************_
********* = *************
path = '\\' + '\\' + '**************\\pythonadmin\\data\\'+*************+'\\plates\\tif\\'
sde = sde_
connect_string = user + '/' + user + '***************' + db_
#local_path = 'C:\\Users\\pythonadmin\\AppData\\Roaming\\ESRI\\Desktop10.3\\ArcCatalog\\'
#local_path = 'C:\\Python_Cloud_Scripts\\conn\\'
local_path = 'E:\\GIS_MXD\\**************\\PLATES_CAD_GIS1.gdb\\'
final_path = 'E:\\GIS_MXD\\**************\\PLATES_CAD_GIS.gdb\\'
sde_conn = local_path + string.upper(sdeusr) + '.sde\\' + sde
plates_gis = '*******************'
asset_path = '\\' + '\\' + '****************\\pythonadmin\\data\\'+************+'\\assets\\' + plates_gis + '\\'
#print start time
starttime = datetime.datetime.today()
print 'Start Time: ' + str(starttime)
timestamp_d = str(starttime.date())
timestamp_t = str(starttime.time()).replace(':','_')
if string.upper(user) == '*************':
projection = "PROJCS['NAD_1983_StatePlane_New_Jersey_FIPS_2900_Feet',GEOGCS['GCS_North_American_1983',DATUM['D_North_American_1983',SPHEROID['GRS_1980',6378137.0,298.257222101]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Transverse_Mercator'],PARAMETER['False_Easting',492125.0],PARAMETER['False_Northing',0.0],PARAMETER['Central_Meridian',-74.5],PARAMETER['Scale_Factor',0.9999],PARAMETER['Latitude_Of_Origin',38.83333333333334],UNIT['Foot_US',0.3048006096012192]];IsHighPrecision"
elif string.upper(user) == 'CUC_DELMARVA':
projection = "PROJCS['NAD_1983_StatePlane_Delaware_FIPS_0700_Feet',GEOGCS['GCS_North_American_1983',DATUM['D_North_American_1983',SPHEROID['GRS_1980',6378137.0,298.257222101]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Transverse_Mercator'],PARAMETER['False_Easting',656166.6666666665],PARAMETER['False_Northing',0.0],PARAMETER['Central_Meridian',-75.41666666666667],PARAMETER['Scale_Factor',0.999995],PARAMETER['Latitude_Of_Origin',38.0],UNIT['Foot_US',0.3048006096012192]];IsHighPrecision"
else:
projection = "PROJCS['WGS_1984_Web_Mercator',GEOGCS['GCS_WGS_1984_Major_Auxiliary_Sphere',DATUM['D_WGS_1984_Major_Auxiliary_Sphere',SPHEROID['WGS_1984_Major_Auxiliary_Sphere',6378137.0,0.0]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Mercator'],PARAMETER['False_Easting',0.0],PARAMETER['False_Northing',0.0],PARAMETER['Central_Meridian',0.0],PARAMETER['Standard_Parallel_1',0.0],UNIT['Meter',1.0]];IsHighPrecision"
def end_process(self):
endtime = datetime.datetime.today()
print 'End Time: ' + str(endtime)
def MakeFolder(self,**********,gis):
gp = arcgisscripting.create()
folderpath = '\\' + '\\' + '****************\\pythonadmin\\data\\' + ************ + '\\assets\\' + gis + '\\'
if os.path.exists(folderpath) == False:
print 'Folder does not exist'
os.mkdir(folderpath)
os.chdir(folderpath)
os.mkdir(folderpath + 'spatial\\')
gp.CreateFileGDB(folderpath, str(gis)+'.gdb')
else:
print 'Folder already exists'
filelist = []
gp.Delete_management(folderpath+gis+'.gdb')
filelist = os.listdir(folderpath + 'spatial\\')
a=0
while a < len(filelist):
os.remove(folderpath + 'spatial\\'+ filelist[a])
a=a+1
gp.CreateFileGDB(folderpath, str(gis)+'.gdb')
a=0
print 'Folder creation complete'
def FormatTupleNum(self,num):
numstr = ""
numstr = num
return numstr.lstrip('(').rstrip('),')
def get_filelist(self):
global filelist
global path
filelist = os.listdir(path)
print "Files:"
print filelist
def get_map(self):
global connect_string
global maplist
x=0
con = cx_Oracle.connect(connect_string)
cur = con.cursor()
#maps = 'CC3D'
#cur.execute('select b.name from PLATE_MAPS_DETAIL a, MAP_VIEWS b where A.MAP_NAME = B.NAME and a.map_name = '+'\''+maps+'\'')
cur.execute('select b.name from PLATE_MAPS_DETAIL a, MAP_VIEWS b where A.MAP_NAME = B.NAME order by b.name')
#cur.execute('select map_name from asset_plates_gis order by creation_date')
maplist = cur.fetchall()
while x < len(maplist):
#mapstr = ''
mapstr = self.FormatTupleNum(str(maplist[x]))
maplist[x] = mapstr.replace('\'','')
x=x+1
print 'Maps:'
print maplist
con.commit()
#con.close()
def create_tfw(self):
global path
global maplist
x=0
y=0
self.get_map()
con = cx_Oracle.connect(connect_string)
cur = con.cursor()
coordnumber = '1.3369988'
cur.execute('delete from ASSET_PLATES')
con.commit()
while x < len(maplist):
mapstr = ''
mapstr = maplist[x]
print mapstr
try:
print path + mapstr +'.tif'
modified_time = time.asctime(time.localtime(os.path.getmtime(path + mapstr +'.tif')))
cur.callproc('pkg_assets.populate_asset_plates',(mapstr,modified_time))
cur.execute('SELECT b.LLX FROM PLATE_MAPS_DETAIL a, MAP_VIEWS b WHERE A.MAP_NAME = B.NAME and a.map_name = '+'\''+mapstr+'\'')
coordllxlist = cur.fetchone()
coord_llx = ''
coord_llx = self.FormatTupleNum(str(coordllxlist[0]))
cur.execute('SELECT B.URY FROM PLATE_MAPS_DETAIL a, MAP_VIEWS b WHERE A.MAP_NAME = B.NAME and a.map_name = '+'\''+mapstr+'\'')
coordurylist = cur.fetchone()
coord_ury = ''
coord_ury = self.FormatTupleNum(str(coordurylist[0]))
f = open(path + maplist[x] + '.tfw','w')
f.write(coordnumber + '\n')
f.write('0' + '\n')
f.write('0' + '\n')
f.write('-'+coordnumber + '\n')
f.write(coord_llx + '\n')
f.write(coord_ury)
print maplist[x] + '.tfw created'
f.close()
con.commit()
except:
print"Cannot find image " + mapstr
x=x+1
con.commit()
#con.close()
def generate_plate_gis(self):
global user
global maplist
global plates_gis
global local_path
global temp_table_conn
global sde_conn
global connect_string
con = cx_Oracle.connect(connect_string)
cur = con.cursor()
x=0
counter=0
#populate new plates into ASSET_PLATES_GIS
cur.callproc('pkg_assets.get_new_asset_plates')
con.commit()
#self.MakeFolder(user, plates_gis)
print local_path+plates_gis
if arcpy.Exists(local_path+plates_gis) == True:
while x < len(maplist):
mapstr = ''
mapstr = maplist[x]
counter = cur.callfunc('pkg_assets.update_plates',cx_Oracle.NUMBER,[mapstr])
if counter > 0:
print mapstr + ' will be updated.'
try:
sqlexpression = "\"NAME\" = \'" + mapstr + ".tif\' OR " + "\"NAME\" = \'" + mapstr + ".TIF\' OR " +"\"NAME\" = \'" + mapstr + "\'"
print sqlexpression
sttime = datetime.datetime.today()
print 'Start Time: ' + str(sttime)
arcpy.MakeRasterCatalogLayer_management (local_path+plates_gis, mapstr+"_view", sqlexpression, "", "")
sttime = datetime.datetime.today()
#print 'Make Raster: ' + str(sttime)
#print 'Raster Created'
arcpy.DeleteRasterCatalogItems_management(mapstr+"_view")
sttime = datetime.datetime.today()
#print 'Deleted Raster: ' + str(sttime)
#print 'Deleted existing Raster Catalog record.'
arcpy.RasterToGeodatabase_conversion(path+mapstr+'.tif',local_path+plates_gis)
#arcpy.RasterToGeodatabase_conversion('C:\Python_Cloud_Scripts\*********\BC1Q.tif',sde_conn+plates_gis)
sttime = datetime.datetime.today()
#print 'RasterTo Geo: ' + str(sttime)
#print 'RasterToGeodatabase_conversion'
cur.callproc('pkg_assets.asset_plates_gis_createtime',[mapstr])
con.commit()
print mapstr +' added to SDE Raster Catalog.'
except Exception, e:
print e.message
x=x+1
#arcpy.WorkspaceToRasterCatalog_management(asset_path+plates_gis+'.gdb',sde_conn+plates_gis,"NONE","NONE")
else:
print plates_gis + ' does not exist'
con.commit()
#con.close()
filelist = []
files = os.listdir (local_path)
for filename in files:
if filename.endswith(".lock"):
print 'lock'
else:
filelist.append(filename)
fullpath = local_path + filename
shutil.copy(fullpath, final_path)
#shutil.copy(local_path, final_path)
self.end_process() If needed we could just add to the current code and move it into the mosaic dataset from the GDB. Any...any...help would be massively appreciated as we are all at our programming limits.
... View more
02-26-2020
01:26 PM
|
0
|
11
|
3325
|
|
POST
|
Well it is not a view and we are dealing with daily change on 81,354 features. Because the symbology is built using Z whatever change is done in X & Y have to be reflected in Z. I haven't used triggers in a long time maybe that is what we need. I can explore that. Ok about your side note...but how am I going to really give info enough to make sure people have what they need to answer? I guess they can just ask questions. I just wanted to minimize the back and forth as we all are busy.
... View more
02-26-2020
12:05 PM
|
0
|
0
|
2083
|
|
POST
|
I'm not seeing much action on this. Do I have it in the right area? If not can somebody recommend where it should go?
... View more
02-26-2020
10:06 AM
|
0
|
1
|
2083
|
|
POST
|
Well the item is called out specifically as a check item doing the upgrade. If this is something important ESRI at least should provide more documentation about it. Other than the comment in a doc or 2 and the info from the wonderful people in this thread I have no other info, examples, etc. to guide what the issue is. I plan well so I don't have to worry about things. This is a private company where time done on things has a distinct value so I have to be extra diligent to make sure time spent is as efficient as possible. If things weren't as customized as they are (I learned long ago customization can have a steep cost so I avoided it as much as possible) I wouldn't worry that much about it. But you are right Asrujit and it may come down to that. I've figured out a lot of things in my past by just trying it :-). I just wish ESRI wouldn't put something like that up and not give support to it with documentation. I'll still hope I can get some more info from this thread. I may have to call ESRI about this. Thanks Asrujit for your reply!
... View more
02-25-2020
06:53 AM
|
0
|
1
|
2194
|
|
POST
|
Put it here in case it got clipped...I have a calc that takes 2 fields and concatenates them together in a new field to use for symbology. Then I was told that the fields used are dynamic. Therefore I need the ability where if a person changes a field used in the concatenation it automatically changes the calced, combined field with the new info. I have access to ArcGIS 10.5 thru 10.7 products...the DB is currently 10.2.2 but we will upgrade that soon. Any ideas? I know this may not be the perfect publish location but I don't know where else to post it
... View more
02-24-2020
01:17 PM
|
0
|
19
|
3728
|
|
POST
|
Hi Marco Thanks for the reply. Believe me I agree with George major...unfortunately they didn't do backups as much as they should of here in the past I'm trying to get more info about the "highly customized environment". But I know they have made many changes to give clients very specific functionality. I wish I had specifics right now but this just became a major issue last week. I have avoided large amounts of customization in my career just because of issues like this. Back when I started in the 1980's we needed it because GIS was still coming out of its infancy. Eventually I got rid of almost all of it. Like most geodatabases we have an SDE schema and a User schema. Both have their tables and such as you know. From the limited info I can find so far it appears that if the changes are outside the geodatabase system tables we should be good. I just saw this in a doc about the upgrade tool and its use but what I gave here is about all i found from ESRI or anybody else which has been frustrating. So I really could use the following info still...what things are typically removed? If I have customization in non-geodatabase system tables am I good to do the upgrade without removing it? Has anybody gone thru this and can give some examples of what they did? Is there any ESRI written info that explains this in more detail? I understand Marco that I think you and I are seeing that any customizations outside the geodatabase system tables should be good to leave alone as long as the geodatabase system tables are clean. I just trying to get things as definitive as possible. I always appreciate any info you can give.
... View more
02-24-2020
08:23 AM
|
0
|
3
|
2194
|
|
POST
|
I appreciate George's answer very much! But it really is a pain dealing with that esp in such a highly customized environment like I'm now in. So the next question in the progression is...what specifically has to be removed and is there any documentation that details this action? If we have to remove things like user tables, non-sde that is going to be a pain but if it is just anything in the SDE tables still a pain but not as bad. Can somebody give me info on this please...pretty please? :-). If this is majorly involved we may just do a migration method instead of upgrade. Thanks again George!
... View more
02-21-2020
01:23 PM
|
0
|
5
|
2194
|
|
POST
|
I see some views of this but no answer yet. So just to make sure people know the question...I noticed on the geodatabase (dataset) upgrade documentation for 10.7.X that something says (checklist item): "Have all custom functionality added to the geodatabase system tables outside ArcGIS, such as triggers or additional indexes been removed?" I would like to know is there a way around this step for us?
... View more
02-12-2020
08:42 AM
|
0
|
0
|
2194
|
|
POST
|
I would like to know is there a way around this step? We are going from 10.2.2 to 10.7.1. It is going to add a lot more hassle trying to minimize the downtime for the Production. We have to take things out, do the upgrade and put them back in hopefully as it was before without issues. If we could just do the upgrade without this step we can save time and not risk issues when things are put back. THANK YOU ALL!
... View more
02-12-2020
07:57 AM
|
0
|
9
|
2350
|
|
POST
|
All on this thread...I'm trying to put in a new question and something seems to be wrong with Geonet so I'll try the question here: Does anybody have an opinion on Windows vs. Linux for ArcGIS 10.7.X esp in regard tp performance? Assume the same hardware/software for both OS. Feel free to generalize about things but I'm mainly interested in performance. THANK YOU!
... View more
02-11-2020
06:00 AM
|
0
|
0
|
469
|
|
POST
|
Agreed. Now that I think about it more I'm kinda mixing advantages/benefits and ROI (as a percentage calculation). From what you and Derek said I think an easy ROI would be 40% plus based on doing the DB upgrade from 10.2.2 to 10.7.1. If it was something like 10.5 to 10.7.1 I would say the advantages would be much less significant but the support item along would give me more than 40%. I know to do this I have to get the formal costs worked out but it shouldn't be nothing more than time for a person or 2. Even that shouldn't be a lot of time. What do you think...a moderately competent GIS person...24 - 36 hours putting in some time for an issue or 2? I accessing my experience for both the ROI estimation and the hours needed. Thanks again George!
... View more
02-10-2020
08:13 AM
|
0
|
2
|
2132
|
|
POST
|
One thing though George...Branch versioning isn't available with ArcMap...only ArcGIS Pro 2.1 or later
... View more
02-10-2020
06:55 AM
|
0
|
4
|
2132
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 02-05-2020 01:01 PM |
| Online Status |
Offline
|
| Date Last Visited |
10-15-2021
09:12 AM
|