You are here: > ESRI Forums > arcgis desktop discussion forums > Thread Replies

ArcGIS Desktop Discussion Forums

ArcGIS Desktop - Projections, Projection Engine forum

What happened to batch define projection in...   Frank Panaro May 25, 2004
Re: What happened to batch define projectio...   werner flacke May 26, 2004
Re: What happened to batch define projectio...   William Allen Jul 07, 2004
Re: What happened to batch define projectio...   Melita Kennedy Jul 07, 2004
Re: What happened to batch define projectio...   Hawthorne Beyer May 26, 2004
Re: What happened to batch define projectio...   Rob McCulley Jun 21, 2004
Re: What happened to batch define projectio...   Erik Danielson Jun 28, 2004
Re: What happened to batch define projectio...   Frank Panaro Jun 29, 2004
Re: What happened to batch define projectio...   Kerry Stonestreet Aug 08, 2004
Re: What happened to batch define projectio...   Kim Ollivier Aug 09, 2004
Re: What happened to batch define projectio...   William Allen Aug 09, 2004
Re: What happened to batch define projectio...   Kim Ollivier Aug 09, 2004
Re: What happened to batch define projectio...   Jon Hall Aug 10, 2004
Re: What happened to batch define projectio...   Ray Carnes Aug 25, 2004
Re: What happened to batch define projectio...   Kim Ollivier Aug 26, 2004
Re: What happened to batch define projectio...   Jon Hall Aug 27, 2004
Re: What happened to batch define projectio...   Justin Johnson Nov 23, 2004
Re: What happened to batch define projectio...   Ravin Agarwal Dec 01, 2004
Re: What happened to batch define projectio...   Knut Jetlund Dec 06, 2004
Re: What happened to batch define projectio...   Knut Jetlund Sep 17, 2004
Re: What happened to batch define projectio...   Petter Lande Jul 03, 2005
Add me to the list of peaved users   Alex Zendel Aug 31, 2004
VBA version   Nathan Evans Sep 23, 2004
Re: VBA version   Brian Miller Sep 30, 2004
Re: VBA version   Jason Pardy Oct 01, 2004
Re: VBA version   Anne Patterson Dec 20, 2004
Re: VBA version   Colleen Kiley Jan 21, 2005
Re: VBA version   Nancy Alexander Feb 20, 2005
Vanished Basic Funtionality   Christopher Stebbins May 20, 2005
Re: Vanished Basic Funtionality   Melita Kennedy May 20, 2005
Re: Vanished Basic Funtionality   Peter Bartlett Sep 07, 2006
Re: Vanished Basic Funtionality   Melita Kennedy Sep 08, 2006
Re: Vanished Basic Funtionality   Peter Bartlett Oct 26, 2006
Re: Vanished Basic Funtionality   Melita Kennedy Oct 26, 2006
Re: Vanished Basic Funtionality   Melita Kennedy Oct 27, 2006
Re: Vanished Basic Funtionality   werner flacke Oct 26, 2006
Re: VBA version   Derek CS Burr, AICP Jan 18, 2006
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject What happened to batch define projection in v.9? 
Author Frank Panaro 
Date May 25, 2004 
Message Do I have to use the old ArcView 3.x Projection Utility to batch define projection for shapefiles files now? You can batch project files that already have a projection but not files that need to have a projection defined. You could do this 8.3 so I don't know why it's gone now...

frank 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: What happened to batch define projection in v.9? 
Author werner flacke 
Date May 26, 2004 
Message Frank,

you might want to use scripting. I post a sample.

Werner 
 
# gp_prj_assign.py
#
# Batch assignment of coordinate reference systems to feature classes
'''Batch assing coordinate systems'''

import os, sys, string, win32com.client

# start reporting
import time
me=os.path.splitext(os.path.basename(sys.argv[0]))[0]
print "\n",__doc__,"\n",me,"started at: " + str(time.asctime())
timestamp=time.clock()

# Create the Geoprocessor object
gp = win32com.client.Dispatch("esriGeoprocessing.GpDispatch.1")

try:
    path=sys.argv[1]					   #1
except:
    path="G:\\beta_test\\Tests\\wf\\test_b_def\\"  #1

oplist=[]
gp.workspace = path
fclist = gp.ListFeatureClasses("*")                #2
fclist.reset()
fc=fclist.next()
while fc:
    desc=gp.describe(fc)
    SR = desc.SpatialReference
    if SR.Name == "Unknown":                       #3
        print fc,"has unknown CRS."
        oplist.append(fc)
    fc=fclist.next()
if len(oplist) == 0:
    print "All CRS are known."
    sys.exit(0)
    
crs="27700" # British National Grid

print "assigning",crs,"to",len(oplist),"feature classes..."
for fc in oplist:
    print fc
    try:
       gp.DefineProjection_management (fc, crs)    #4 
       print "CRS",crs,"assigend"
    except:
       print "could not assing CRS",crs,"to", fc
       gp.GetMessages()
       
delta=time.clock()-timestamp
timestamp=time.clock()
print me,"successfully finished:",str(time.asctime()),"\nTotal time in sec:",str(delta),"\n"    
 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: What happened to batch define projection in v.9? 
Author William Allen 
Date Jul 07, 2004 
Message Just curious on that script you provided, you have a crs# for the British National Grid as your defined projection. I've looked through the Developer Help & ArcCatalog and cannot find where the list of crs# are for other coordinate systems. Also, it looks like you need to have all of your layers in one directory for this script to work. Is that true? I am a Python/ArcObjects neophyte so thanks for any assistance you can give...Will 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: What happened to batch define projection in v.9? 
Author Melita Kennedy 
Date Jul 07, 2004 
Message In the desktop help, contents tab, select map projections, getting started with..., An overview..., and then select one of the "learn more about" links. It will open a PDF file with various tables of information.

In developer help, look at the esriSRProjCS* or esriSRGeoCS* enumerations through the index, although they aren't sorted in any particular order so it's rather messy.

Melita 
  Melita Kennedy
ESRI Product Specialist 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: What happened to batch define projection in v.9? 
Author Hawthorne Beyer 
Date May 26, 2004 
Message You can just define one projection and then copy and paste the prj file. (Still a pain I know, but better than defining every single one).

For Grids it is the prj.adf file, for shapefiles it is [shapefilename].prj. I guess this method doesn't help if you've got a Geodatabase though.
Regards,
Hawthorne 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: What happened to batch define projection in v.9? 
Author Rob McCulley 
Date Jun 21, 2004 
Message Why would they remove a feature? I used the batch define all the time. All shapefiles coming off of our GPS unit are undefined. Having to modify a script to deal with them everytime, or do them one at a time is not handy. 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: What happened to batch define projection in v.9? 
Author Erik Danielson 
Date Jun 28, 2004 
Message Likewise have come to rely on the batch define tool - especially for GPS data, and find it very frustrating that this component is gone.

Note to ESRI: it is one thing to rearrange the tools of the software, but quite another just to pull them away completely! 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: What happened to batch define projection in v.9? 
Author Frank Panaro 
Date Jun 29, 2004 
Message Has anyone got any info yet from ESRI why this feature is gone? I sent an email question to tech support but have not gotten an answer back yet. I'm not holding my breath on this one but it would be nice to know why a feature was removed for no apparent good reason? 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: What happened to batch define projection in v.9? 
Author Kerry Stonestreet 
Date Aug 08, 2004 
Message Add me to this list. Kinda hard to get work done in a hurry when I have to fire up the ESRI Support site everytime something's moved or not working like it use to.

Any news on this? 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: What happened to batch define projection in v.9? 
Author Kim Ollivier 
Date Aug 09, 2004 
Message Here is an alternative version to the one above that avoids using the GPDispatch COM object (for speed). It is not as professional, but is simpler and more AML-like.

I added this as a tool with a couple of parameter fields and a default for my normal projection.
 
 
# cpprj.py
# high speed copy projection files to new shapefiles
# because this not available in ArcGIS 9
# emulating AML conventions
# avoid Dispatch object
# but still add as a Toolbox tool
# 
# Kim Ollivier kimo@ollivier.co.nz
# 9 August 2004
"""
   Batch Projection Definition
   Usage cpprj <target_dir> <src_proj_file> 
"""

import os
import sys
import shutil
import glob

# optional, only for log messages
# from win32com.client import Dispatch
# gp = Dispatch("esriGeoprocessing.GpDispatch.1")
			
msgExit = "  Usage: " + os.path.basename(sys.argv[0]) + " <target_dir> {NZMG|srcprj_file} "

if len(sys.argv) == 1 :
	print msgExit
	sys.exit()

dirprj = sys.argv[1]


if not os.path.exists(dirprj) :
	print "  Dir path not found", dirprj
	print msgExit
	sys.exit()

# default projection file for me
default = os.path.normcase("c:\\arcgis\\nzmg.prj")

if len(sys.argv) == 2 :
	srcprj = os.path.normcase(default)
elif len(sys.argv) == 3 :
	srcprj = os.path.normcase(sys.argv[2])
else :
	print "  Too many parameters"
	print msgExit
	sys.exit()
	
if not os.path.isfile(srcprj) :
	print "  Projection file not found for: ", os.path.basename(srcprj), srcprj
	print msgExit
	print os.path.isfile(srcprj)
	sys.exit()

# change to directory 
os.chdir(dirprj)
# get list of shapefiles here
shps = glob.glob('*.shp')
# could use a walk of subdirectories

for shp in shps:
	parts = os.path.splitext(shp)
	newprj = parts[0] + '.prj'
	if not os.path.exists(newprj):
		shutil.copyfile(srcprj,newprj)
		print shp, " projection added"
		# gp.AddMessage(shp + " projection added")
	else:
		print shp, " already defined"
		# gp.AddMessage(shp + " projection already defined")
 
  Kim Ollivier
kimo@ollivier.co.nz
www.ollivier.co.nz
 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: What happened to batch define projection in v.9? 
Author William Allen 
Date Aug 09, 2004 
Message FYI, I am going to bring this up at the ESRI Conference this week. I already put in an official request with ESRI Tech Support for this functionality to return. I am going to advocate that they put it in the ArcView 8.x Tools toolbar of ArcCatalog like they did some of other comparable tools. Here's hoping they include it in the next service pack rather than 9.1 which isn't coming out until mid-'05 at the earliest. In the mean time, keep that 8.3 license handy or use the helpful scripts provided in this forum... 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: What happened to batch define projection in v.9? 
Author Kim Ollivier 
Date Aug 09, 2004 
Message I have found out why a command line doesn't work.
The help example is wrong. You must use a "code" not a "file.prj" projection file, as listed in the pdf.
But the script example uses a different tool called DefineProjection which does need a file.

So NZMG is code 43040 (which I will be burning into my wetware).
This works well for a shapefile but is very slow for an image at 104 seconds. So the tool could do with a bit of optimising if it is actually added back in. And perhaps some command line expansion to enable a list of feature sets to be processed??
eg DefineProjection_management 43040 *.shp
 
 
# command line example using a <code> not a <file.prj>
workspace d:/teararoa/motatapu/aerial
DefineProjection_management f40a.tif 43040

# dialog window:
Executing (DefineProjection_7): DefineProjection D:\teararoa\motatapu\aerial\f40a.tif GEOGCS['',DATUM['',SPHEROID['',1.0,0.0]],PRIMEM['',0.0],UNIT['',1.0]] D:\teararoa\motatapu\aerial\f40a.tif
Start Time: Tue Aug 10 09:22:18 2004
Executed (DefineProjection_7) successfully.
End Time: Tue Aug 10 09:24:02 2004 (Elapsed Time: 104.00 secs)

 
  Kim Ollivier
kimo@ollivier.co.nz
www.ollivier.co.nz
 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: What happened to batch define projection in v.9? 
Author Jon Hall 
Date Aug 10, 2004 
Message Add me to the list of disgruntled users.

I believe the "why" is that they took out some of the code running behind the scenes to make Project and Define Projection "modular" tools that can be incorporated into Python scripts and Models.

That's great for those who want to learn Python, however it adds a big productivity hit to everyone who wants simple functionality using ArcGIS out-of-the-box.

I've managed to write a model that I can re-use to batch project with a pre-defined output spatial reference. The one "gotcha" is that if a Datum Transformation is required, the combo box that used to populate itself with applicable transformations in 8.3 no longer does so in 9.0

I searched and eventually found the transformation codes under "esriSRGeoTransformation2Type Constants", but it still did not accept the Nadcon NAD27 to NAD83 transformation.

esriSRGeoTransformation_NAD_1927_TO_NAD_1983_NADCON
1241
NAD27 to NAD83 - CONUS.

I'm waiting for ESRI to put a little effort into fixing the ArcGIS 9.0 Projection tools before I waste any more of my valuable production time trying to guess my way through another undocumented interface. Nice thing about being an ESRI user is that I almost always have a lot of nice people suffering along with me. 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: What happened to batch define projection in v.9? 
Author Ray Carnes 
Date Aug 25, 2004 
Message ESRI is pleased to announce the release of the "Data Management Toolbox".

This toolbox contains a script that defines the spatial reference (includes the coordinate system) for multiple rasters or feature classes in a workspace.

http://support.esri.com/index.cfm?fa=downloads.geoprocessing.filteredGateway&GPID=6

Ray Carnes,
ESRI Technical Marketing. 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: What happened to batch define projection in v.9? 
Author Kim Ollivier 
Date Aug 26, 2004 
Message This link is a fancier version of the preceeding Python examples. You are supposed to run it from a DOS command prompt!
I chose to also run it from at least a Cygwin shell, or a Pythonwin environment with some extra performance logging and turning off the chatter as each object is defined.

Why not a proper ArcGIS Toolbox interface?

I added my own tool and spent a morning setting up the input form parameters and help documentation. I do not consider it a "toolbox" as it stands. It does not seem to take any longer as a script.

Performance is still very disappointing, it takes about 2 seconds per jpeg file, but for some reason
is much faster than my earlier experiment of 104 seconds using the command line for a single feature as posted above.

Each object takes 0.3 a second to just even check, compared to my example (avoiding GPDispatch) to check the existence of a prj file of 4 milliseconds. That is 75 times slower.

To add the projection file takes 3 seconds compared to a copy of the prj file for a shape at 6 milliseconds. The geoprocessor also generates a metadata xml file that I actually do not want, presumably taking a lot more time. It certainly takes some heavy processing, my CPU runs at 70 percent to create the prj and xml file.

Unfortunately you have to use the GPDispatch object for images because they do not use a prj file but a binary aux file. Similarly for features in a geodatabase.

So there you go, get a faster machine upgrade the software and work 75 times slower. What time will a real job take? Not much incentive to use the command line.

 
  Kim Ollivier
kimo@ollivier.co.nz
www.ollivier.co.nz
 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: What happened to batch define projection in v.9? 
Author Jon Hall 
Date Aug 27, 2004 
Message Yes, Kim, I too spent the better part of an hour after downloading the "Data Management Toolbox", setting up the script parameters in ArcToolbox, and trying my best to document them, as this isn't something the majority of my GIS department's Techs could accomplish. No way could they run it at a command line. I tested quickly, it worked, and then I had to get back to production work.

When I first saw the "Data Management Toolbox" download, I was about to post a "Thank You" to ESRI, then thought I better check it out before assuming the problem was solved. After struggling to make the script work in ArcToolbox, it is a disappointment.

This download is still a far cry from the functionality in ArcGIS 8.3 !!! ESRI's development team does not seem to appreciate the time constraints their software users work under in the real world. 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: What happened to batch define projection in v.9? 
Author Justin Johnson 
Date Nov 23, 2004 
Message The VBA method from ArcScripts works well. It's about 1/4 as long as the code I was using before to reproject rasters and this one works with any Dataset.

I made a couple of slight improvements. The code below will exit if no dataset is selected and it uses the ISpatialReferenceDialog to obtain the spatial reference.

It makes you wonder why the Batch Project tool was ever removed. 
 
Public Sub MultiSpatRef()
  
  Dim pApp As esriCatalogUI.IGxApplication
  Dim pGxSelection As esriCatalog.IGxSelection
  Dim pEnumGX As esriCatalog.IEnumGxObject
  Dim pGxObject As esriCatalog.IGxObject
  Dim pName As esriSystem.IName
  Dim pDS As esriGeoDatabase.IDataset
  Dim pGDSE As esriGeoDatabase.IGeoDatasetSchemaEdit
  Dim pSpatRef As esriGeometry.ISpatialReference
  
  Set pApp = esriArcCatalog.Application
  Set pGxSelection = pApp.Selection
  Set pEnumGX = pGxSelection.SelectedObjects

  Set pGxObject = pEnumGX.Next
  
  'Exit if no dataset is selected
  If pGxObject Is Nothing Then
    MsgBox "Select a dataset", vbCritical, "No dataset selected"
    Exit Sub
  End If
    
  Set pSpatRef = SelectSpatRef
  
  'Exit out of sub if you "Cancelled" the Coordinate System dialog box
  If pSpatRef Is Nothing Then
    Exit Sub
  End If

  Do Until pGxObject Is Nothing
    If TypeOf pGxObject Is esriCatalog.IGxDataset Then
    
      Set pName = pGxObject.InternalObjectName
      Set pDS = pName.Open
      Set pGDSE = pDS
      
      With pGDSE
        If .CanAlterSpatialReference Then
          .AlterSpatialReference pSpatRef
        End If
      End With
      
    End If
    Set pGxObject = pEnumGX.Next
  Loop

End Sub


Private Function SelectSpatRef() As esriGeometry.ISpatialReference

  Dim pSpatRefDialog As esriCatalogUI.ISpatialReferenceDialog
  Set pSpatRefDialog = New esriCatalogUI.SpatialReferenceDialog
  
  Set SelectSpatRef = pSpatRefDialog.DoModalCreate(False, False, False, 0)

End Function
 
  Justin Johnson
SLC, UT 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: What happened to batch define projection in v.9? 
Author Ravin Agarwal 
Date Dec 01, 2004 
Message I have read several examples on how to batch project all files in a directory. Does anyone know how to batch project all files in multiple sub-directories under a single directory.

For example. the directory AVDAFIF contains a couple of text files, and then about 8 subdirectories. Each sub directory contains a number of files that need to be projected to WGS84.

Thank you. 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: What happened to batch define projection in v.9? 
Author Knut Jetlund 
Date Dec 06, 2004 
Message This script seems to work for multiple subdirectories. You have to change the values for ws (Main directory) and cs (projection file) to fit your project.
 
 
# ---------------------------------------------------------------------------
# Define projection for all feature classes in a main directory and subdirs
# Created: Dec 6 2004
# Author: Knut Jetlund (knut.jetlund@forsvarsbygg.no)
# ---------------------------------------------------------------------------

# Import system modules
import sys, string, os, win32com.client

# Create the Geoprocessor object
gp = win32com.client.Dispatch("esriGeoprocessing.GpDispatch.1")

# Path to the main directory
ws = "D:\Test"
gp.workspace = ws
gp.AddMessage("Main directory: " + ws)

# Path and name for the projection file 
cs = "C:/Programfiler/ArcGIS/Coordinate Systems/Projected Coordinate Systems/Utm/Wgs 1984/WGS 1984 UTM Zone 32N.prj"

# Create a list of subdirectories (workspaces) under the main directory
workspaces = gp.listworkspaces()

# Loop through all workspaces, starting with the main directory
while gp.Exists(ws):
  gp.workspace = ws
  gp.AddMessage("Workspace: " + ws)

  #Find feature classes in the current workspace  
  datasets = gp.listfeatureclasses()
  dataset = datasets.Next()
  
  # Loop through all feature classes and set projection
  while dataset:
    gp.AddMessage("Defining projection for " + dataset)
    gp.DefineProjection_management(dataset, cs)
    dataset = datasets.Next()
    
  # Find next workspace
  ws = workspaces.Next()
 
  Knut Jetlund
 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: What happened to batch define projection in v.9? 
Author Knut Jetlund 
Date Sep 17, 2004 
Message I have created a simle script for this purpose. It works for me, but it's very slow. 
 
# ---------------------------------------------------------------------------
# Define projection for all shapefiles in a directory
# Created on: to sep 16 2004 02:10:09 
# ---------------------------------------------------------------------------

# Import system modules
import sys, string, os, win32com.client

# Create the Geoprocessor object
gp = win32com.client.Dispatch("esriGeoprocessing.GpDispatch.1")

# Load required toolboxes...
gp.AddToolbox("C:/Programfiler/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx")

# Local variables...
# Path to the directory
gp.workspace = "D:/Kart/grunnkart/Vektor/K50lib/UTM_33_SHAPE_NY"
gp.toolbox = "management"

# extension
type = "shp"
# Path and name for the projection file 
cs = "C:/Programfiler/ArcGIS/Coordinate Systems/Projected Coordinate Systems/Utm/Wgs 1984/WGS 1984 UTM Zone 33N.prj"

# Find files in the directory
files = os.listdir(gp.workspace) 

# Loop through all files looking for shapefiles
for f in files :
  ext = string.lower(os.path.splitext(f)[1][1:])
  if ext == type :
    print "Definerer projeksjon for " + f + "... "
    # Process: Define Projection...
    gp.DefineProjection_management(f, cs)
    

 
  Knut Jetlund
 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: What happened to batch define projection in v.9? 
Author Petter Lande 
Date Jul 03, 2005 
Message Ray,

I am assuming the script in http://support.esri.com/index.cfm?fa=downloads.geoprocessing.filteredGateway&GPID=6 is what has made it back in to ArcToolbox for SP3 of ArcGIS Desktop 9.0?

Anyway, this tool has a glitch: When having chosen a coordinate system, the Transformation box does not become a drop down containing valid transformation options, as it does for other tools (e.g. Project). As I have not found a way to make this tool work without specifying the transformation, I have to find the correct text string in another tool and manually type it in. Also; should this box really read "optional"? It sure doesn't seem optional to me.

regards,
Petter Lande
Senior GIS developer
Prevista AS, Kongsberg, Norway 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Add me to the list of peaved users 
Author Alex Zendel 
Date Aug 31, 2004 
Message I understand ESRI's need to occaisonally make changes to their software to facilitate increased functionality and software development/engineering strategies. But the blow to the end users is something that should be equally considered, if not more. I am currently under some harsh deadlines and need to mass reproject an entire directory of shapefiles for our clients. Having to search for examples/suggestions/code on how to do this unnecessarily wastes a lot of time that I do not have! This also makes me look bad when I cannot deliver the data in a timely manner.

ESRI, if you feel that changes are necessary, then please do them. But at the same time, please keep the end user in mind (and the user's boss/clients who expect rapid results).

AZ 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject VBA version 
Author Nathan Evans 
Date Sep 23, 2004 
Message There is a VBA version of this in ArcScripts for those of you (like me) who haven't got Python quite under their belt.

Nathan

http://arcscripts.esri.com/details.asp?dbid=13664 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: VBA version 
Author Brian Miller 
Date Sep 30, 2004 
Message To all and ESRI

I have spent very long this afternoon trying to get the BatchDefineProjection.py script to work, with no avail! The VBA version worked great and also in about 1 second of time.

I appreciate scripts are useful, but they are useless if step by step guidelines are not provided. Not all users out here are experts in scripting (though with better guidance they can improve) and the old Toolbox was 100 times better!

Another frustrated customer! 
  Brian Miller
(Data & GIS Officer, BBOWT, UK) 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: VBA version 
Author Jason Pardy 
Date Oct 01, 2004 
Message Hey Brian,

What about the VBA code attached? This is much more simple and understandable than the VBA sample provided above.

There is a readme file attached with the sample python script. What steps are missing or difficult to understand? Simply telling us it is useless is not helpful. This script is more flexible than this sample code below. You can not only define projections for multiple featureclasses, but also rasters.

Anyways, hope this code helps. If you read the ArcGIS Desktop Help>>Geoprocessing>>Writing Geoprocessing Scripts, there is an entire section on writing scripts to do batch processing.

Jason 
 
Sub BatchDefineProject()

    Dim pGP As Object
    Set pGP = CreateObject("esriGeoprocessing.GpDispatch.1")
    
    'Set the workspace with the featureclasses
    pGP.Workspace = "C:\uc2004\shapefiles"
    
    'Set projection file
    prjfile = "C:\ArcGIS\Coordinate Systems\Geographic Coordinate Systems\World\WGS 1984.prj"
    'NOTE: This could be a path to an existing featureclass with the projecton I want.
    
    'Get list of shapefiles or featureclasses
    Dim fcs As Object
    Set fcs = pGP.ListFeatureClasses("*")
    
    'Get the first featureclass from list
    fc = fcs.Next()
    
    'Loop through and define a projection
    Do While Not fc = ""
       pGP.DefineProjection_management fc, prjfile
       fc = fcs.Next()
    Loop

End Sub
 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: VBA version 
Author Anne Patterson 
Date Dec 20, 2004 
Message Thanks,

I just ran this last script and it seemed to work well with my project. Thanks for posting this. I'd be eager to hear if ESRI will add a service pack to make the ArcToolbox9 have all the functionality of version 8.

The other thing from Arc8 that I would have liked to continued to use in version 9 was the geoprocessing wizard. Finding the same functions in ArcToolbox takes more time that using this wizard. 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: VBA version 
Author Colleen Kiley 
Date Jan 21, 2005 
Message I'm just going to add my unhappy voice to this thread in the hopes that if enough people complain, ESRI will do something to fix this issue. The 8.x batch projection definition tool was great. I used it all the time. I don't have the time or desire to try to learn a scripting language or search for scripts to replace basic important functionality that used to be part of ArcGIS. I want to sit down to each new version of ArcGIS with the knowledge that I can do everything I used to do, and more, not less. ESRI, please start thinking about the end user again and not the convenience of the software programmers!! So that's my two cents worth...
Thanks to those who have posted fixes here. I'd be even more frustrated without them! 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: VBA version 
Author Nancy Alexander 
Date Feb 20, 2005 
Message These are the instructions in the readme.txt with the batch define projection:
********************
HOW TO RUN THIS SCRIPT:
The recommended way to execute this script is run it at the Command (dos) Prompt.
Open the Command Prompt and type the path to the script and specify the parameters.

The example below will define a projection to all the shapefiles in C:\workspace with the same
projection as that of C:\workspace\template.shp.

E.g. C:\scripts\BatchDefineProjection.py C:\workspace C:\workspace\template.shp
*****************

when run, the shapefiles are not given a prj. why?

I have correctly configured the paths the script and for my working directories.

Thanks in advance. 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Vanished Basic Funtionality 
Author Christopher Stebbins 
Date May 20, 2005 
Message The Batch Define tool is GONE.

The Batch Project with built-in Transformations is GONE.

What does this mean? Disgruntled ESRI User #3,456. 
  -----

Chris Stebbins
GIS Analyst
CH2M Hill, PDX 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: Vanished Basic Funtionality 
Author Melita Kennedy 
Date May 20, 2005 
Message Christopher,

All the arctoolbox tools were rewritten for version 9. Some functionality could not be finished in that timeframe. Other functionality was added that do make certain tasks more flexible. For instance, now that the tools have command lines, it's possible write scripts and not have to deal with the UIs.

There are several ready-made tools available in ArcScripts that support batch definition of coordinate systems. Here's the results of a search:

http://arcscripts.esri.com/scripts.asp?eLang=&eProd=28&perPage=10&eQuery=batch+define&Submit2=Search

I don't see a ready-made batch project tool, but scripting is still available. The Project tool also lost the ability to define custom geotransformations. We're adding that back in for version 9.2.

Melita Kennedy
ESRI Product Specialist 
  Melita Kennedy
ESRI Product Specialist 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: Vanished Basic Funtionality 
Author Peter Bartlett 
Date Sep 07, 2006 
Message Melita Kennedy

Hi Melita

I see that ESRI is adding the finctionality to define custon geotransformations back into the Project Tool at 9.2.

I could really use this now. I'm trying to use a custom NTV2 style gsb file to move utility layers. I created the gsb file by comparing small shifts between some old digital cadastre and some new improved digital cadastre. Both cadastral datasets share the same datum and projection, I just want to move the utility layers (pipes, cables etc) associated with the old cadastre, to a new improved location. Do you have any advice or code that will help?

Regards

Peter Bartlett
Hunter Water Australia 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: Vanished Basic Funtionality 
Author Melita Kennedy 
Date Sep 08, 2006 
Message Hi Peter,

There are two possibilities that I can think of. The first is to write a VBA script that you can use in ArcMap to define the custom transformation (because the UI doesn't support defining file-based transformations). I'm not at work so I can't post or send you a sample. You might want to search this forum for a sample using NADCON/HARN/NTv2 as any of them would work. I'll search later and see if I can find one.

The second solution is to use a 'back-door' into the projection engine. Set an environment variable to a directory like c:\temp. The user environment variable should be called PEOBJEDITHOME. In the directory, add a text file called GEOGTRAN (no extension). In the text file add an entry like:

GEOGTRAN,208001,"my_new_transformation",PE_GCS_AGD_1984,PE_GCS_GDA_1994,PE_MTH_NTV2,PE_PAR_DATASET_NAME,new.gsb

For the two geographic coordsys (GCS) you need to use either the projection engine macros or the factory (aka EPSG) codes. I might have the PE_PAR name wrong too (PE_PAR_NAME_DATASET) so try both.

You also may want to look at this thread:

http://forums.esri.com/Thread.asp?c=93&f=984&t=151078&mc=6#msgid441506

which discusses the issue. Werner Flacke also posted some tools in the thread--he works at ESRI-Germany.

Melita 
  Melita Kennedy
ESRI Product Specialist 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: Vanished Basic Funtionality 
Author Peter Bartlett 
Date Oct 26, 2006 
Message Hi Melita

I have tried some of your sugestions but no result. I now think my problem may be in the way ArcGIS handles NTv2 files. Can you tell me: Is there a limit on how large the value for GS_COUNT can be in an NTv2 distortion grid file? Also, I have created my distortion grid based on a 20 m cell size converted to arcseconds. This of course ends up being decimal number less than 1. Can ArcGIS handle this or must the cell size be an integer value for arcseconds and therefore the latitude and longitude increments must be integers?
Finally the bounds of my distortion grid file are not necessarily integers either. Does this matter to ArcGIS?

Regards

Peter Bartlett 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: Vanished Basic Funtionality 
Author Melita Kennedy 
Date Oct 26, 2006 
Message Hi Peter,

I've sent your questions on to our programmer who implemented NTv2. If you want, you could send the file to me and we can try it here. He has a program to read the header, and we can see if it works the way we should. I won't keep it or distribute it.

If you're agreeable, send it to mkennedy AT esri DOT com.

Melita 
  Melita Kennedy
ESRI Product Specialist 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: Vanished Basic Funtionality 
Author Melita Kennedy 
Date Oct 27, 2006 
Message Peter,

The programmer reports--

1. GS_COUNT is a signed integer, 2^31 - 1 or
2147483647 cells

2. The cell sizes use double precision so they do not have to be integer values.

3. The lat/lon extents for the subgrids do not have to be integers either; double precision values are fine.

But with decimal edges and cells sizes, you have to make sure that the math all works out so you get an integer value for the rows and columns. I'm not sure how much 'flex' there is in that calculation. I'll ask the programmer about that later today.

Hope this helps,
Melita 
  Melita Kennedy
ESRI Product Specialist 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: Vanished Basic Funtionality 
Author werner flacke 
Date Oct 26, 2006 
Message Peter,

please excuse my late reply. Your task contains two details which I'm not familiar with:
Sub second increments and moving from and to the same datum.
What I know from my own experience is: If the gsb file is wrong, nothing happens. No error, no shift.
Sub second (or non integer) increments or limits may be such an error. If the datum doesn't change, that might also break the rules. It makes no sense in the context of a geographic transformation.

Instead you could consider a spatial adjustment based on links. That could be slow but tolerable if you only need to adjust your data once.

Werner Flacke
ESRI Germany 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: VBA version 
Author Derek CS Burr, AICP 
Date Jan 18, 2006 
Message I have attempted a couple of these examples, but keep running into a snag.
I get the VB compile error: Ambiguous name detected: SpatialDomainAnalysis.
Any ideas? 
  Derek CS Burr, AICP, GISP