Thanks to Mohammad Aouad |
ArcGIS Server, ArcGIS, C#.net Articles, Tutorials, Code snippets... And more...
Tuesday, December 8, 2009
Saturday, November 28, 2009
Dynamic Charting for ArcGIS Desktop
Thursday, November 26, 2009
Advanced Large Scale Applications with Silverlight at PDC 09
Video
Presentation
Demo Source Code
Thursday, November 12, 2009
What is new in ArcGIS 9.4
See this video from Esri site that explains the major 9 features coming in ArcGIS 9.4
Monday, October 12, 2009
Easy ArcGIS Library Initiated
EAGL is a set for .net assemblies that make working with ArcGIS common tasks easy and direct.
EAGL is an example of the Facade design pattern where you have a complex system with a lot of functionalities (ArcObjects) and you access 20% of this functionality 80% of times.
EAGL will make accessing that 20% part easy an direct.
I've hosted my new project on Google codes, and I'm using subversion as my revision control system.
EAGL was created using C# .net (3.5).
All contributors are welcome, we need for now a documentation writer ;)
Download EAGL 1.0 from here
Sunday, October 11, 2009
Exporting Source Code to HTML
Any way to get back to main subject, to export your source code to HTML get Notepad ++, which is a free great editor that has many plug-ins, one of them called NP export did and amazing job in exporting my code to HTML, a lot of programming languages are supported.
Links:
Notepad++ Site
Download Notepad++
Friday, October 9, 2009
Data Tranfer between workspaces
Preface
Copying data between workspaces is a day-to-day piece of work for ArcGIS users, and so for developers.
In this article I’m going to show you how to use ArcObjects to copy data between different workspaces.
Actually there are many approaches for doing so in ArcGIS, each of them has some limitation in its functionality, after doing some research on the subject I found that you could transfer data between workspaces in one of these ways:
1- Write a manual code to do the operation from scratch.
2- Use the IDataset.Copy().
3- Use Geoprocessor object.
4- Use IFeatureDataConverter interface.
5- Use IGeoDBDataTransfer interface.
So as I said each of the above ways has some limitation in functionality, IDataset.Copy as the help says: “should only be used with datasets from file-based data sources, such as shapefiles and coverages”, Geoprocessor is great but I had some difficulties passing an ArcSDE workspace as a parameter to the copy tool, that keep IFeatureDataConverter and IGeoDBDataTransfer, I tried both of them and they seem to work fine. So we will see now two examples on using IFeatureDataConverter and IGeoDBDataTransfer to copy a feature class from workspace to another.
A. Using IFeatureDataConverter
The interface IFeatureDataConverter has only one implementer class which is FeatureDataConverter, the beauty of this class is that it checks for field naming conflicts and removes them using IFieldChecker.
I’ll try to make my examples simple and clear, and this is difficult when working with ArcObjects (You know).
So our main goal is to copy a feature class from one workspace to another using IFeatureDataConverter using ConvertFeatureClass method.
This method is defined like:
public IEnumInvalidObject ConvertFeatureClass (
IFeatureClassName InputDatasetName,
IQueryFilter InputQueryFilter,
IFeatureDatasetName outputFDatasetName,
IFeatureClassName outputFClassName,
IGeometryDef OutputGeometryDef,
IFields OutputFields,
string configKey,
int FlushInterval,
int parentHWND
);
What is important to us is underlined.
So the main steps for this approach would be:
1- Get the FeatureClassName from input FeatureClass.
2- Get the WorkspaceName from input FeatureClass to be used with IFieldChecker later.
3- Create new FeatureClassName with the new name and supplied workspace.
4- Get the fixed Fields from FieldChecker.
5- Call the ConvertFeatureClass method of FeatureDataConverter.
Code
public void ConvertFeatureClass(IFeatureClass inFeatureClass, IWorkspace outWorkspace, string newName)
{
// get FeatureClassName for input
IDataset inDataset = inFeatureClass as IDataset;
IFeatureClassName inFeatureClassName = inDataset.FullName as IFeatureClassName;
IWorkspace inWorkspace = inDataset.Workspace;
// get WorkSpaceName for output
IDataset outDataset = outWorkspace as IDataset;
IWorkspaceName outWorkspaceName = outDataset.FullName as IWorkspaceName;
// Create new FeatureClassName
IFeatureClassName outFeatureClassName = new FeatureClassNameClass();
// Assign it a name and a workspace
IDatasetName datasetName = outFeatureClassName as IDatasetName;
datasetName.Name = newName == "" ? (inFeatureClassName as IDatasetName).Name : newName;
datasetName.WorkspaceName = outWorkspaceName;
// Check for field conflicts.
IFieldChecker fieldChecker = new FieldCheckerClass();
IFields inFields = inFeatureClass.Fields;
IFields outFields;
IEnumFieldError enumFieldError;
fieldChecker.InputWorkspace = inWorkspace;
fieldChecker.ValidateWorkspace = outWorkspace;
fieldChecker.Validate(inFields, out enumFieldError, out outFields);
// Check enumFieldError for field naming confilcts
//Convert the data.
IFeatureDataConverter featureDataConverter = new FeatureDataConverterClass();
featureDataConverter.ConvertFeatureClass(inFeatureClassName, null, null,
outFeatureClassName, null, outFields, "", 100, 0);
}
The above function converts (Copy) the supplied feature class to the targeted workspace, if no name provided it will use the name of the supplied feature class.
B. Using IGeoDBDataTransfer
The use of GeoDBDataTranfer is used in ArcCatalog for copy and paste oprations, so I really prefer this way.
The main steps for this approach would be:
1- Get the name Objects from input.
2- Prepare Transfer parameters (IEnumName and IName).
3- Generate Name Mappings.
4- Do the transfer.
Code:
private void transferData(IFeatureClass sourceFeatureClass, IWorkspace targetWorkspace)
{
// Get Name Objects
IDataset ds1 = sourceFeatureClass as IDataset;
IDataset ds2 = targetWorkspace as IDataset;
IFeatureClassName fcName = ds1.FullName as IFeatureClassName;
IWorkspaceName2 targetWSName = ds2.FullName as IWorkspaceName2;
// Prepare Transfer Parameters
IName fromName = fcName as IName;
IName toName = targetWSName as IName;
// Prepare input enum and add fromName to it
IEnumName fromNameEnum = new NamesEnumerator();
IEnumNameEdit fromNameEnumEdit = (IEnumNameEdit)fromNameEnum;
fromNameEnumEdit.Add(fromName);
// Generate name Mapping
IGeoDBDataTransfer transferer = new GeoDBDataTransferClass();
IEnumNameMapping fromMapping;
bool v = transferer.GenerateNameMapping(fromNameEnum, toName, out fromMapping);
// Do The Transfer
transferer.Transfer(fromMapping, toName);
}
Note: The above approach doesn’t support old file based Workspaces (Shape Files, Coverages), to copy those you can use IDataset.Copy method.
Note: The class GeoDBDataTransfer implements the interface IFeatureProgress so you can show a user a feedback about the copy operation progress, but although they say in the help that Step is an event of type some delegate you can’t use this interface in .net because it is not supported.
I hope this was useful for you, and hope to see some feed back.
Wednesday, October 7, 2009
Not Only ArcGIS Server
It seems very difficult to have free time for blogging, especially when you have such a pressure on a "Lgical" dead line...
Anyway this is not a techical article, it is just a warm up...
Our Blog title says ArcGIS server, but never mind you will find articles on many subjects, not considering ArcGIS server is the main topic in this blog...
We will focus on:
- ArcObjects programming for Desktop, Engine, Server, Mobile platforms.
- ADF
- General articles and tutorials in programming using C#, ASP.net
- Some non-technical articles
I know .. I know it seems good... I just hope this was a real warming up...
Monday, October 5, 2009
Sunday, March 22, 2009
ArcGIS API for Microsoft Silverlight™/WPF™ is available as a public BETA
what Silverlight API Can Do:
Download the Silverlight API HERE
Getting Started with Silverlight API HERE
Silverlight API Samples HERE
Live Samples HERE
ArcGIS Server Silverlight Resource Page
Tuesday, March 3, 2009
ArcGIS Explorer 900 at the 2009 PUG
http://blogs.esri.com/Info/blogs/arcgisexplorerblog/archive/2009/02/23/arcgis-explorer-900-at-the-2009-pug.aspx
Saturday, February 28, 2009
ArcGIS Silverlight API Developers talk about it in details
Saturday, February 14, 2009
Silvelight API OR Flex API ?? Confused ?
Silverlight 2.0 Books Remommedation
Wiley - Silverlight 2 Bible
APress - Pro Silverlight 2 in C#
Tuesday, February 3, 2009
Getting Familiar with LINQ
I Found a perfect LINQ Samples for C# HERE and i hope that it helps others.
Monday, February 2, 2009
Google Earth 5 BETA Release
* Historical imagery from around the globe
* Ocean floor and surface data from marine experts
* Simplified touring with audio and voice recording
you can download it HERE
Sunday, February 1, 2009
Saturday, January 31, 2009
ArcGIS Silverlight Demo Video
You Can Find the video HERE
Thursday, January 29, 2009
ArcGIS API for Microsoft Silverlight (Coming Soon)
Wednesday, January 28, 2009
ArcGIS API for Microsoft Silverlight
Take a look at Introduction to the ArcGIS API for Microsoft Silverlight here
Take a look at Patterns and Best Practices for Building Applications with the ArcGIS API for Microsoft Silverlight here
Saturday, January 24, 2009
Saturday, January 17, 2009
ArcGIS Server 9.3 & Windows 7 Beta Build 7000
here are some screenshots
ArcGIS Server Manager |
ArcGIS Server Connection Through ArcCatalog |
ArcGIS Desktop 9.3 & Widnows 7 Beta Build 7000
ArcMap 9.3 Installation |
ArcMap Up and Running |
Tuesday, January 13, 2009
How to accept an invalid SSL certificate programmatically
here is how you do it
// callback used to validate the certificate in an SSL conversation
private static bool ValidateRemoteCertificate(
object sender,
X509Certificate certificate,
X509Chain chain,
SslPolicyErrors policyErrors
)
{
if (Convert.ToBoolean(ConfigurationManager.AppSettings["IgnoreSslErrors"]))
{
// allow any old dodgy certificate...
return true;
}
else
{
return policyErrors == SslPolicyErrors.None;
}
}
what u need to do is to create a parameter in the app.config and give it a key
"IgnoreSslError" and set this to true or false up to ur conviniece and here is how you
streetmps_buffered.TrackingWS.Service m_proxy = new streetmps_buffered.TrackingWS.Service();
ServicePointManager.ServerCertificateValidationCallback += new RemoteCertificateValidationCallback(ValidateRemoteCertificate);
m_proxy.WriteDataAsync(m_DriverName, m_CurrentGPSPoint.X.ToString(), m_CurrentGPSPoint.Y.ToString(), (int)SMNavigation.MilesToKilometers(m_CurrentSpeed), DateTime.Now.ToString());
hope it helps others
Friday, January 2, 2009
Creating an ESRI Toolbar With ArcGIS Server Flex API
you can view a sample HERE and as its goning to be always you can get the source code HERE
just set 2 properties, ApplicationMap to you Map Id and the ToolbarDirection to horizontal or vertical and ur done