Select to view content in your preferred language

How do you reproject a featureset without creating a featureclass?

424
2
07-28-2010 02:17 AM
KimOllivier
Honored Contributor
If you use the tool form setting to collect an interactive point as a featureset you get the coordinates in the current projection. I want to turn that into a WGS84 lat/long to query a web service that requires that format.

The only way I can see to do this is by setting an output projection and using a cursor to write a table, then open it up again to see what happened. But the whole point of featuresets is to avoid exactly that sort of inefficiency.

There (was), IS an AML function to project a point returned by &Getpoint &Map.
Here is the Workstation help snippet
[SHOW CONVERT <in_units> <xy> <out_units>]
Returns the converted x,y coordinates from units in one specified coordinate space to units in another specified coordinate space. UNITS can be PAGE, MAP, PROJECTEDMAP, or GRAPH. The respective MAPEXTENT, MAPPROJECTION and GRAPHEXTENT must be set first.
0 Kudos
2 Replies
KimOllivier
Honored Contributor
Well I suppose an in_memory featureclass is OK

 latlong.py
# get a point from NZTM and convert to lat/long
#

import arcgisscripting

gp = arcgisscripting.create(9.3)

inFeatSet = gp.GetParameter(0)
gp.OverwriteOutput = True
inFeatSet.Save("in_memory/pointer")

row = gp.SearchCursor("in_memory/pointer","","c:/arcgis/nzgd2000.prj").next()
lat = row.shape.centroid.Y
long = row.shape.centroid.X
gp.AddMessage(str(lat)+" "+str(long))
del row
0 Kudos
KimOllivier
Honored Contributor
Which gave me the idea to try a cursor on a featureset, and that worked too!

# latlong.py
# get a point from NZTM and convert to lat/long
#
import arcgisscripting
gp = arcgisscripting.create(9.3)
inFeatSet = gp.GetParameter(0)
row = gp.SearchCursor(inFeatSet,"","c:/arcgis/nzgd2000.prj").next()
lat = row.shape.centroid.Y
long = row.shape.centroid.X
gp.AddMessage(str(lat)+" "+str(long))
del row
0 Kudos