Geometry functions or geoprocessing

1734
2
01-30-2012 04:35 AM
Labels (1)
RobertZargarian
New Contributor III
Hi,

I was trying to find following operations on geometries for disconnected mode running on file-gdb. Many of these functions
exist in GeometryService class but I could not find anything in LocalGeometryService. Do this means that I have to
make Geoprocessing packages (for tools that exists for runtime) and then use those packages to run tools on my file-gdb?

I tried to use Editor Object to do those operations for me (cut, union, reshape). But the problem is that Editor uses
Commands and I could not find a way to send parameter and get the result an operation. For ex. I would like to
construct a line and a polygon and send them to Cut(line,polygon) and get back a list of polygons without user interaction.

I have also done some testing on making Geoprocessing packages and using them. The first thing I noticed was that
some standard tools are not the same as I was expected them to be. For ex. Union does not construct a polygon union in the same
way as Editor Class does. I tried also Intersect and got â??Error 500â?? all the time. See the attached file.
The second thing was that executing tools took long time 5-6 seconds for union between 2 polygons or buffer a point.
Is there a way to make this tools run faster? In_memory workspace or other way?


Thanks!

Geometry Functions
Polygon

Get ExteriorRings of a polygon.
Get InteriorRings of a polygon.
Get LablelPoint of a polygon.
Construct Buffer of a polygon.
Construct union between polygons.
Construct intersect between polygons.
Get Boundary of a polygon.
Cut a polygon with a line.
Construct Difference between polygons.

Polyline
Split a polyline at a Point.
Construct Buffer of a polyline.

Point
Buffer a point.
Project point coordinates from one coordinate system to another.
0 Kudos
2 Replies
MichaelBranscomb
Esri Frequent Contributor
Hi,

The GeometryService is actually a task which, like any other task in the API requires a URL to work. the LocalGeometryService is actually a class for administering a local instance of a geometry service. The slight difference in naming convention arises from trying to maintain consistency with the web APIs (JavaScript, Flex, SilverLight) and the mobile APIs (Windows Phone, etc). So all you need to do is start a LocalGeometryService then pass it's Url property to the GeometryService task. Fortunately, we've added a convenient local extension to the GeometryService class to help you do this - so the simplest code to achieve this becomes a two liner:

GeometryService geometryTask = new GeometryService();
geometryTask.InitializeWithLocalService();
//... use the GeometryService to perform an operation e.g. Project();

... Or if you want to do this asynchronously:

GeometryService geometryTask = new GeometryService();
geometryTask.InitializeWithLocalServiceAsync(localGeometryService =>
{
//... use the GeometryService to perform an operation e.g. Project();
});

The functionality is the same whether you are using an online GeometryService instance or a local/offline instance. This will help with most of your requirements. The polygon class of geometry supports multiple rings which will cater for exterior rings and interior rings. The geometry must have been created clockwise to be valid in this respect. If the geometry was created counter clockwise you can use the Simplify method on the GeometryService task class to generate topologically valid geometry.

Cheers

Mike
0 Kudos
RobertZargarian
New Contributor III
Tanks!
Now I can use LocalGeometryService for nearly all geometry operations.
0 Kudos