Checkout ArcGIS License(s) in Standalone ArcObjects Application

by Nate 31. May 2007 18:22

I'm sure many of you who build a lot of standalone ArcObjects applications already know this, but I work mostly on server and mobile applications, and have never run into the problem.

Up until the release of ArcGIS 9.1, standalone ArcObjects applications initialized themselves with any available ArcGIS licenses, not requiring developers to explicitly grab a license when writing an ArcObjects application. This changed with 9.2, and the change was not very well-documented. I ran into this new 'feature' recently when trying to perform a simple connection to an SDE geodatabase. The code was very straightforward and compiled fine, and I couldn't - for the life of me - figure out why it wouldn't work. Then I ran into a couple of helpful posts on the ESRI support forums, which put me on the right track.

First, links to the posts:

Now, a solution to the problem. In this example, I'm grabbing an ArcInfo license:

 

public void MainForm_Load(object sender, EventArgs e)
{
//Create new AoInitialize object, used in checking out/in ArcGIS license(s) AoInitialize m_pAoInitialize = new AoInitialize();

//Try to initialize license try { if (m_pAoInitialize.IsProductCodeAvailable(esriLicenseProductCode.esriLicenseProductCodeArcInfo) == esriLicenseStatus.esriLicenseAvailable)
{
m_pAoInitialize.Initialize(esriLicenseProductCode.esriLicenseProductCodeArcInfo);
}
else { MessageBox.Show("ArcInfo license not available. Check your network connection.");
}
}
//Catch any errors catch (Exception exception)
{
MessageBox.Show("Error: " + exception);
}
}

 

Also make sure that you also shut down the AOInitialize object when you're done with it. From the EDN documentation:

"Before an application is shut down the AOInitialize object must be shut down. This ensures that any ESRI libraries that have been used are unloaded in the correct order. Failure to do this may result in random crashes on exit due to the operating system unloading the libraries in the incorrect order."

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

ArcObjects

1-800-GOOG-411

by Nate 24. May 2007 04:54

This one may be more important to me than it is to others, but having just moved to a new city this past September, I find myself dialing 411 more than I'd like from my mobile phone. To be honest, I dialed it quite a bit even before I moved into these new and unexplored areas. Well, Google is proposing a solution to all those extra charges! I found this one on the Google LatLong blog, but haven't tried it out yet. I'm sure I will, though, in the very near future (tomorrow, and probably the next day, and the next...).

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Life

A Few Nifty Corners 'Gotchas'

by Nate 19. May 2007 20:08


I'm sure most of you who, like me, hate using tables in your web design already know about Alessandro Fulciniti's wonderful Nifty Corners. If you don't, a quick summary (or you can find all the information you need at the creator's website): Nifty Corners is a set of javascripts and some associated css that, when combined, allow you to round corners of divs and other css elements. While the ability to round corners has been around for quite some time, before Nifty Corners you had to use images or extra - very bulky - markup to get the desired effect.

I've worked with Nifty Corners on several design projects, and it seems like everytime I use them I forget to double-check a few things and it takes me longer than it should to get them working. Well, to save my sanity during future projects and to hopefully help some other poor, forgetful soul out there, here are the common 'gotchas' that I always run into when using Nifty Corners:

  • Always, always, always double-check the paths of your .css and .js files. If you have to separate the niftyCorners.css file from the two javascript files, you'll have to change the path that's referenced in the niftyCube.js "AddCSS" function.
  • You don't have to add the niftyCorners.css to your webpage (although it is necessary), this is all done in the javascript.
  • It is easy - and probably a good idea - to combine the two .js files into a single javascript. To do this, simply cut and paste the contents of the niftyLayout.js script into the top of the niftyCube.js script.
  • Rather than initiating the javascript with a "window.onload" event, I like to call the initiating function from the <body onload> event. Personal preference, I guess, but this allows me to use "windows.onload" for something else without having to implement the workaround presented on the Nifty Corners website.

If you follow these tips, you can have beautiful rounded corners through the use of a single .js script and with *very* minimal configuration. Note that this entry is not meant to be a complete walkthrough for using Nifty Corners on your site; the Nifty Corners website has tons of examples that you can reference. This is just intended to help those who run into difficulty when implementing the technique.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Javascript

Connecting MapDotNet Server 2007 to ArcSDE 9.2

by Nate 11. May 2007 19:48

I've been experimenting quite a bit recently with MapDotNet Server 2007 (from hereon, referred to as MDNS), and I'll say that I'm pretty impressed. Building maps in MDNS is admittedly more difficult than simply publishing an .mxd with ArcGIS Server - MDNS uses MapServer's map file format, but the power of gaining access to Virtual Earth base data far outweighs the trouble that it takes to build the application and the performance is killer when compared to the alternatives. One thing I've noticed, though, is that the documentation/support site for MDNS still needs a lot of work. It's obvious that ISC has put some work into their help in the recent past, but there are still lots of topics that need to be covered in much more detail.

One of the topics that is only briefly covered in the support portal wiki is integrating ArcSDE with an MDNS application. The steps are briefly outlined in the "ArcSDE Integration" wiki entry, but there really needs to be a comprehensive step-by-step walkthrough for a topic as important as this. If it were a true wiki, I would be able to edit the page and update the documentation for others to use, but I have yet to find a way to contribute. So I'm going to put up my little walkthrough here (as much for myself as for anyone else) and hope that it either gets integrated into the support site or that ISC updates their documentation soon.

There are three steps to the process, first you need to download the "libmap.dll.sde92" dll (it wasn't included with the MDNS 2007 6.0 release for some reason), second you need to enable ArcSDE connections via MapDotNet Server 2007, and last you need to connect your specific application to an SDE geodatabase. Make sure that you perform all of the steps on both your development machine and your web server.

  1. Download the "libmap.dll.sde92" dll:
    1. Click on the following link to download a .zip with the dll in it.
    2. Unzip the dll and put it in the "\IGNORED_LIBMAP_DLLS" directory, which is located at "C:\Program Files\MapDotNet Server\v6.0\MapDotNetServer Web Service\bin\IGNORED_LIBMAP_DLLS" in a default install.
  2. Enable ArcSDE Connections via MapDotNet Server 2007:
    1. Install the ArcSDE 9.2 C SDK:
      1. The C SDK is included with your ArcSDE 9.2 install media.
      2. Initiate the install by either inserting the disk and using the Autorun installation GUI or browsing to the "\ArcSDE\windows\ArcSdeSDK" directory and double-clicking "setup.exe".
      3. Choose "ArcSDE C SDK" from the installation window and let it run to completion.
      4. Add a Path variable to point to the ArcSDE\bin directory:
        1. In Windows, right-click on "My Computer" and select "Properties" from the context menu.
        2. Click on the "Advanced" tab and then the "Environment Variables" button near the bottom of the window.
        3. In the "System variables" section, scroll down to the "Path" variable and double-click it to open the "Edit System Variable" window.
        4. Go all the way to the end of the "Variable value:" field and add the following to the end: ";C:\ArcGIS\ArcSDE\bin" (without the quotations).
        5. Click "OK" three times to exit out of all the dialogs.
      5. Reset IIS by opening up a command line and running "iisreset".
    2. Browse to the "\IGNORED_LIBMAP_DLLS" directory, which is - again - located at "C:\Program Files\MapDotNet Server\v6.0\MapDotNetServer Web Service\bin\IGNORED_LIBMAP_DLLS" in a default install, and copy and paste the "libmap.dll.sde91" dll into the "\bin" directory.
    3. Stop the "World Wide Web Publishing" service, as it likely has a lock (via the aspnet_wp) on the "libmap.dll":
      1. Right-click on "My Computer" and select "Manage".
      2. Expand the "Services and Applications" console.
      3. Click on "Services".
      4. Scroll down to the bottom, right-click on "World Wide Web Publishing", and select "Stop" from the context menu.
    4. Cut and paste the "libmap.dll" dll from the "\bin" directory into the "\IGNORED_LIBMAP_DLLS" directory (just for safe-keeping).
    5. Rename the "libmap.dll.sde92" dll that you placed in the "\bin" directory to "libmap.dll".
    6. Restart the "World Wide Web Publishing" service:
      1. Back in "Computer Management" (see #3 above), restart the service by right-clicking on it and selecting "Start" from the context menu.
  3. Connect Your Application to an SDE Geodatabase:
    1. Open your application's .map file using either the "MapFile Generator" or your preferred text editor.
    2. Add a new layer to your .mapfile, using the following connection information (replace the red with your data source information):


 CONNECTION "SERVER,port:PORTNUMBER,DATABASE,USERNAME,PASSWORD"
 CONNECTIONTYPE SDE
 DATA "DATABASE.USERNAME.NAMEOFFEATURECLASS,SHAPE,SDE.DEFAULT"
 PROCESSING "CLOSE_CONNECTION=DEFER"

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

ArcGIS Server | MapDotNet Server

Powered by BlogEngine.NET 1.4.5.0
Theme by Mads Kristensen
GeoURL