|
POST
|
Web Mercator? Isn't this just a sop for a simple sphere that G**gle insists that must be used to map the world? Its not a proper projection because it has no datum. I think that is why there is no projection using a cursor option. Try pretending it is WGS84 and suck hard on the registration errors, which is evident on every road network overlay of the images in GE or GM. I use the projection option on cursors and it works for me. I can even get the transform between two datums to work as well if I match the projection names exactly to suit the transform. I could not find an easy way to project a shape object. I had to write out a temporary featureclass to the scratch workspace, not in_memory. (I got the shape object from an interactive pick using a tool, and then I needed the pick coordinate in lat/long to query a server.)
... View more
03-08-2011
04:46 PM
|
0
|
0
|
2803
|
|
POST
|
The best way to load CSV files is to define the schema in schema.ini in the same folder. This is by the Microsoft Text File driver that many Windows applications use including ArcGIS. It has no limits on file sizes and many other benefits. You can define the field separator, rename the field names, set fields types and text widths. If the first row has field names you can use them, skip them or rename them. It is very flexible and fast. I have only recently discovered how useful the schema.ini definition can be. It saves having to write a Python script to parse and load the data into a table. You can just add the CSV file and export it to a geodatabase so you can edit and use it. http://webhelp.esri.com/ARCGISDESKTOP/9.3/index.cfm?TopicName=Accessing_delimited_text_file_data If you are going to create an XY event table, be aware that this is in memory and may be very slow converting it to a featureclass, or it may even fail. For very large files it may still be better to use an insertCursor to write a point featureclass directly in Python.
... View more
03-07-2011
03:04 PM
|
0
|
0
|
1134
|
|
POST
|
You have to run it as a tool and add an output parameter. In the tool the parameter is set to DERIVED and in the script you set the parameter to the layer.
... View more
03-07-2011
02:41 PM
|
0
|
0
|
1920
|
|
POST
|
There is a developer sample written in VB6 that will export topological errors to a separate featureclass. This would help you find and edit the errors more easily. It is a DLL written for 9.2 but still works in 9.3.
... View more
03-07-2011
11:06 AM
|
0
|
0
|
5429
|
|
POST
|
Multipoint featureclasses are a separate class from point featureclasses. You can't 'leave the rest alone' in the same featureclass. It doesn't really matter, single points groups will be just the same as a normal point, after a dissolve the featureclass will be multipoint. The problem then is that the featureclass is incompatible with 'singlepoint' so you cannot merge or cut-and-paste, just as you cannot merge lines into polygons [unless you use Workstation]. A further issue you might be trying to solve is to aggregate the multipoints into a single point. This would require a different tool, which finds the centroid of the cluster to place a single point.
... View more
03-07-2011
10:53 AM
|
0
|
0
|
4188
|
|
POST
|
Yes, I see it there, it is what I use in 9.3. Since 9.3 locators are supported at 10, I assumed that this was there to support previous locators. We have a custom standardiser for 9.3 and its not clear how to create a custom standardiser at 10. I will have to investigate further. (I also see the help for it that you need an ArcInfo licence to use the standardiser, but the licence matrix contradicts that and has a tic for all licence levels.[ licence : noun, license:verb in English])
... View more
03-07-2011
10:45 AM
|
0
|
0
|
1089
|
|
POST
|
ET Geowizards has a tool for this. http://www.ian-ko.com/ It costs a little but works really well for me and saves me a lot of coding.
... View more
03-07-2011
10:23 AM
|
0
|
0
|
852
|
|
POST
|
I see you are using a cursor and looping through each feature to reconstruct a geometry object. At 10.0 you can read a whole featureclass into an array of geometry objects in one step without a cursor. You can also write out an array to a featureclass as well. That avoids the cursor both ways, but the disadvantage is that the attributes are separated. You don't say what you are doing with the featureclass in the DLL, I am curious what you have to do that is not already available in the geoprocessing tools.
... View more
03-07-2011
10:16 AM
|
0
|
0
|
3042
|
|
POST
|
There is a projection parameter option on the cursor objects that will reproject to new coordinates as you read the records. Getting a transform to work as well is a bit tricky, but basically set that as well as a string.
# extent_xy.py
# add extents of parcels in NZMG to a NZTM dataset for backward compatibility
# update to use on the fly projection directly from NZTM layers
# see Werner Flacke's book and script example
# updated for 9.2
# Kim Ollivier 13 April 2007
# input NZTM coverage library, parcel and plabel coverages
# output csv files to load and join back to coverages using AML
# issues solved:
# add spatial reference to SearchCursor
# define a Geographic Transformation that works with a coverage
# because coverages cannot define NZGD2000 use WGS84 definition
# or the transform is ignored
import os,sys,glob,arcgisscripting
gp = arcgisscripting.create()
def parcel(tile) :
print "Parcel",tile
ws = "e:/lib/nztm/tile/t"+str(tile)+"/data"
outfolder = "e:/lib/nztm/tile/t"+str(tile)+"/data"
ds = ws + "/parcel"
f1 = open(outfolder+"/e_parcel.txt","w")
f1.write("par_id,eminx_nzmg,eminy_nzmg,emaxx_nzmg,emaxy_nzmg\n")
gp.Workspace = ds
print ds
# this is a good on-the-fly switch for the searchcursor
# srOut must be a com object, not a file ref or a factory code
rows = gp.SearchCursor(ds+"/polygon",'"PAR_ID" > 0',srOut)
n = 0
rows.Reset()
row = rows.Next()
while row :
print >> f1,"%d,%s" % (row.par_id,row.shape.Extent.replace(" ",","))
row = rows.Next()
n +=1
del rows
print n,"Polygons"
f1.close()
return
def plabel(tile) :
print "Plabel",tile
ws = "e:/lib/nztm/tile/t"+str(tile)+"/data"
ds = ws + "/plabel"
outfolder = "e:/lib/nztm/tile/t"+str(tile)+"/data"
f2 = open(outfolder+"/e_plabel.txt","w")
f2.write("par_id,eminx_nzmg,eminy_nzmg\n")
gp.Workspace = ds
rows = gp.SearchCursor(ds+"/point",'"PAR_ID" > 0',srOut)
n = 0
rows.Reset()
row = rows.Next()
while row :
n += 1
print >>f2,"%d,%s,%s" % (row.par_id,row.shape.Extent.split()[0],row.shape.Extent.split()[1])
row = rows.Next()
del rows
print n,"plabels"
f2.close()
return
# ------ main ----
#
srOut = gp.CreateObject("SpatialReference")
srOut.CreateFromFile("c:/arcgis/nzmg.prj")
# WGS_1984 works for coverages defined with an equivalent custom Transverse projection definition
gp.GeographicTransformations = 'NZGD_1949_To_WGS_1984_3_NTv2' # ;New_Zealand_1949_To_NZGD_2000_3_NTv2'
# but is this being used?
inFC = "e:/lib/nztm/tile/t1009/data/plabel/point"
# not at 9.3?? outFC = "in_memory/dummy1.shp"
outFC = "c:/tmp/dummy1.shp"
outPrj = "c:/arcgis/nzmg.prj" # cannot be a COM object or factory id 43040
geoTrans = "NZGD_1949_To_WGS_1984_3_NTv2" # ;New_Zealand_1949_To_NZGD_2000_3_NTv2"
if gp.Exists("c:/tmp/dummy1.shp") :
gp.Delete("c:/tmp/dummy1.shp")
#
gp.OverwriteOutput = 1
gp.MakeFeatureLayer_management(inFC,"tlayer","PLABEL# < 3")
gp.Project_management("tlayer",outFC,outPrj,geoTrans)
try :
if sys.argv[1].upper() == 'ALL' :
lstTile = range(1001,1013)
else :
lstTile = [ tile for t in sys.argv[1].split(",")]
except :
lstTile = range(1001,1013)
print "begin extent_xy"
for t in lstTile :
print t
parcel(t)
plabel(t)
... View more
03-06-2011
06:40 PM
|
0
|
0
|
1066
|
|
POST
|
I find you have to export the unmatched addresses as a table, not a featureclass which has null shapes for the unmatched addresses. Open the table of the featureclass, make a selection STATUS = 'U' , hide the generated fields and export. (9.3, haven't tried 10.0) I wish we could just switch locators and rematch the filtered set, with a tag for which geocoder that matched the address instead of just an "A", it would be much tidier. You would think that you could change the "active" locator in the geocoding toolbar and that would then be used. I know that composite locators are designed to do this, but I need to pause and consider the errors, maybe do a global fix before running another locator.
... View more
03-03-2011
12:59 PM
|
0
|
0
|
969
|
|
POST
|
This is very disappointing. I always standardize before geocoding to enable me to scan for global errors to be fixed before geocoding to improve the match rate, and even more important, to reduce false positives. I can populate missing fields from lookup tables, sort and scan for spelling mistakes, and diagnose reversed elements such as flat and street number. So now I will have to reinvent a standardiser using regular expressions in Python? It might therefore be a while before I switch to 10 locators. Maybe someone clever could generate a regular expression parser from the XML lot definitions? What do other geocoders do to pre-process the source tables?
... View more
03-03-2011
12:37 PM
|
0
|
0
|
1089
|
|
POST
|
The training course notes suggest that all the Reset methods are to be implemented "in the future". Meanwhile you have to close the cursor and reopen it to get the equivalent.
... View more
02-28-2011
06:56 PM
|
0
|
0
|
1464
|
|
POST
|
Kim, I don't seem to have any issues creating a FC with mixed states of single and multipart (made a singlepart dissolve, and then a multipart dissolve, and merge together - no error). What error do you get? I think maybe I'm not grasping your issue? Polygons are inherently multipart so the dissolved and undissolved subsets merged successfully. It applies to points. There is a Point featuretype and Multipoint featuretype which cannot be merged. I now have the difficult decision to have all parcel labels as multiparts or create two layers which then makes searching a single table, easy joins, counting all more difficult. I could abandon points and store the attributes on the polygons directly, but that has other inconveniences such as polygon label placement and text rotation is not possible.
... View more
02-24-2011
01:44 PM
|
0
|
0
|
2257
|
|
POST
|
Use a search cursor (read only) to get out the objectid and your counters into a dictionary. Then you can manipulate the list using direct tools on libraries. Finally open an update cursor and put back the changes. It is very hard to process using a cursor otherwise because you can only step through in one direction.
... View more
02-23-2011
06:41 PM
|
0
|
0
|
1364
|
|
POST
|
I agree 5 hours is far too long. I have a rule of thumb that states "If a single process takes longer than a cup of coffee, then interrupt it and find a better way". I will not be able to produce benchmarks with times longer that a cup of coffee, life is too short. I now remember my recent 'better way' was to use a Workstation intersect which only took a few minutes, I have to admit that an ArcGIS intersect failed first on the same data and since I have a better way I was quick to take that rather than research the issue. I was already using a file geodatabase that is indexed and cleaned. It was already on a local high speed disk drive. It failed quickly. The idea of looping through the features using a script seems likely to take a very long time because of the overhead of starting an intersect process for each likely polygon/polyline combination. You would have to search to find which combinations to compare and this needs a spatial index to be efficient but even then it would be slow. Python is supposed to be a 'glue' of fast optimised tools, not the tool itself. So, alternative tools seem the best course. I have tried another intersect in ArcGIS 10.0 SP1 on an Acer laptop with Windows 7, i5 Intel 4 core processor, 4GB of memory Polygons 42,496, polylines 221,896, tolerance 1 metre, time 5min 43sec. Nothing wrong with that. So to your data not performing. Clean the layer, maybe generalize a little for the purpose of the overlay. Are they both in a local projection? In a local file geodatabase? Get out of SDE. On a local disk? Output to a local file geodatabase. Strip off unnecessary fields. Is your scratch workspace a file geodatabase (not just a folder)? Do you have any unusually large features? Split them up. Multi-parts are not good for geoprocessing, split into singleparts.
... View more
02-23-2011
12:12 PM
|
0
|
0
|
637
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 09-15-2024 10:32 PM | |
| 1 | 03-12-2026 01:10 AM | |
| 1 | 03-13-2026 08:30 PM | |
| 1 | 03-13-2026 05:17 PM | |
| 1 | 03-12-2026 05:14 PM |
| Online Status |
Offline
|
| Date Last Visited |
03-13-2026
05:04 PM
|