Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
C# Objects used for Serving Data to ESRI Web APIs
C#
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
com/esri/ags
net/odoe/geo/helpers
README.textile
sample.cs

README.textile

C# Objects for use with ArcGIS.

I thought there might be some interest in these, since I couldn’t find any samples when I needed them.
These are the basic ESRI objects you would use in a .NET application that can be served out to any web API. They are fully serializable with the ArcGIS Flex API and most recently I have been using them in .NET MVC Web Services for the ArcGIS JavaScript API.

For example, in the ESRI Flex API, the class FeatureSet has a RemoteAlias defined.
[RemoteClass(alias=“com.esri.ags.FeatureSet”)]
public class FeatureSet{…}

Then in your RemoteObject Service, we have a C# counterpart class called com.esri.ags.FeatureSet.
This means, you can create an instance of this class in your service and return the raw FeatureSet and your Flex application will atomatically serialize the Remote FeatureSet to the ESRI Flex counterpart. Pretty cool right?

This is a sample of how I would convert an ArcObjects Polygon to the equivalent Serializable Object.

com.esri.ags.SpatialReference m_sr = new com.esri.ags.SpatialReference();
m_sr.wkid = 102100;
ESRI.ArcGIS.Geometry.Polygon poly = (Polygon)m_geom; // Some previous polygon geometry retrieved using ArcObjects
int count = poly.PointCount;
com.esri.ags.geometry.MapPoint[] mp = new com.esri.ags.geometry.MapPoint[count];
com.esri.ags.geometry.Polygon pg = new com.esri.ags.geometry.Polygon();
pg.rings = new com.esri.ags.geometry.MapPoint[1][];
for (int i = 0; i < count; i++)
{
	ESRI.ArcGIS.Geometry.IPoint pt = poly.get_Point(i);
	mp[i] = new com.esri.ags.geometry.MapPoint(pt.X, pt.Y, m_sr);
}
pg.rings[0] = mp;

So far, these are working for my current needs. Please feel free to use and update as needed.

I have also included a helper class called net.odoe.geo.helpers.FeatureHelper.
A sample of how to use the helper class can be found in sample.cs in this repo.

Disclaimer
I am not employed or affiliated with ESRI beyond being a user of their products.

Enjoy.

License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Something went wrong with that request. Please try again.