Wednesday, July 28, 2010

So That's What "The Cloud" Means

ArcGIS Server Blog : ArcGIS Server on Amazon EC2: The Basics

Cool! It would be so nice to not worry about server issues that invariably arise. Let Amazon worry about that. Then I can focus on GIS.

Anyone going to try it out?

Monday, July 26, 2010

Dojo Dijits: Object Oriented JavaScript Goodness

Object Oriented Programming is a programming style that views the world as a set of objects with properties and methods. When programming with JavaScript, it's easy to fall into a scripting mindset and fire off code in one giant method. This makes your code hard to read and debug. It can also lead to copying/pasting and redundant code. The first step to breaking this habit is to refactor as much as possible. However, this can only take you so far. The next step is breaking out sets of related methods into separate objects. Fortunately for those of us that work with the ArcGIS API for JavaScript, we have access to the wonderful world of Dojo Dijits.

If you've worked with the JS API before you have probably already used a Dojo Dijit. These are prepackaged code and markup that you can plug right into your applications. Dijit.form.Button and Dijit.form.Slider are very common examples. These are great, but the real fun comes in creating your own.

This article by Matthew Russell was my first introduction to creating your own custom Dijits (look for "Creating You Own Widgets"). It's not as complicated as you would think. The building blocks consist of three files (links to my files are included):
  • An .html file containing the markup code (hit view source to see the code).
  • A .js file containing all of the JavaScript.
  • A .css file containing all of your styling.
    After doing the work to create your own Dijit, it's as easy to use as any regular Dojo Dijit. I've created a full screen map dijit that I use for several of my applications. It includes goodies such as map resizing, an animated navigation toolbar, basemap layers and error wiring. It's great to spend time only once refining my design and code and then easily reusing it. And when I make improvements, all of my applications are automatically updated.

    Here's what it looks like in the current app that I'm currently working on. You'll see references to the map dijit and a tools digit.
    HTML:
    <body class="nihilo"> <div id="mapDijit" dojoType="mapDijits.mapDijit_FullScreen"></div> <div id="toolsDijit" dojoType="mapDijits.toolsDijit"></div>


    JavaScript:
    <script type="text/javascript"> //require newly created dijit dojo.require("mapDijits.mapDijit_FullScreen"); dojo.require("mapDijits.toolsDijit"); dojo.require("dojo.parser"); // global var g = {}; g.baseURL = "http://gis.sandy.utah.gov/ArcGIS/rest/services/"; g.PermitsURL = g.baseURL + "Public_Works/Road_Cut_Permits/MapServer"; function init(){ // get map dijit and tools dijit var mapDij = dijit.byId("mapDijit"); var toolsDij = dijit.byId("toolsDijit"); // set map dijit for tools dijit toolsDij.mapDijit = mapDij; toolsDij.setup(); // add permits layer mapDij.addLayer(g.PermitsURL, cached=false, wireErrors=true); // add buttons toolsDij.addButton(label="Add Line", iconClass="drawLineIcon", method=drawLine); toolsDij.addButton(label="Add Point", iconClass="drawPointIcon", method=drawPoint); }


    You can see it in action in my Core Samples and Pavement Markings live applications. Anyone else using custom Dijits out there?

    Tuesday, July 20, 2010

    Salt Lake GIS Users Group (SLUG): 08-11-2010

    Salt Lake GIS Users Group (SLUG): 08-11-2010

    The RSVP's are coming in fast. Better hurry or you'll miss out on lunch.

    While your at the SLUG site, take a minute to complete our annual topics survey to help direct future meetings.

    Monday, July 12, 2010

    ESRI UC Fun

    I, sadly, am not in San Diego right now for the ESRI User Conference. I'm trying to keep up as best as I can through the magic of the internet. "The Fee" is live-blogging the plenary right now if you are interested.

    For those who are there, I would recommend DTS Agile's UC Back Channel. Aside from the beautiful web design and interesting use of the JavaScript API, it looks like a lot of fun. The prizes look interesting although it doesn't look like they're going to get enough participation for iPad's. I like this tee:
    #GEOGLOBALDOMINATION
    I'M KIND OF A BIG DEAL
    ON TWITTER #ESRIUC

    Thursday, July 8, 2010

    Another ESRI API Following The Dinosaurs

    It seemed like only yesterday that the Web ADF was ESRI's next big thing. But after only a few years of existence it looks to be on the way out. If you are jumping up and down with joy right now, you are not alone. I'm feeling quite relieved that I could never wrap my head around it even after taking an ESRI class. Maybe I wasn't the only one?

    Tuesday, July 6, 2010

    My First ESRI Add-in

    I've converted my first ArcMap .NET customization to the new ESRI add-in format. I could have just rebuilt my existing COM project with the new 10 libraries, but I wanted to test out the add-in functionality so I dove into the documentation for converting existing projects. The basic workflow for me was to create a new project in Visual Studio of type "ArcMap Add-in". Then I told the wizard what elements I wanted to include in my add-in which for me included a dockable window and a command button. Then I simply copied the code from my old project to the new one. There were only a few minor changes that I need to make including the slink new global variables that make it a cinch to access commonly used objects like ArcMap.Document. After successful debugging and compiling I came up with this:
    Now, all I have to do to install my tool is double-click on the esriAddIn file. This is so much simpler than worrying about registering COM .dll's. I can't wait to convert the rest of my projects and start passing them around. Anyone else created any add-in's yet?

    Friday, July 2, 2010

    It's Alive! - ArcGIS Desktop 10 Initial Thoughts

    There's just something fun about upgrading. Everything's new and shiny. Aside from the official what's new,  here's a few of my thoughts after using it for a day or so.


    The UI Redesign is beautiful. I like the new icons. They have a modern feel, but are similar enough to the old ones that you can still find what you are looking for. Here's a taste:

    Dynamic Text is a great replacement for my old VBA code that automatically updated text elements that showed the current date and path to the .mxd.

    VBA is officially unsupported at 10. You can still use it but you have to install the VBA developer kit as well as request a license (free) from ESRI and then install it manually on you license server. It's totally gone with the next release. While I knew that this was coming, I'm still amazed at all of the VBA out there that's going to have to be ported to a .NET addin or the arcpy module. Thank goodness that I've got experience with both types of development.

    You cannot administer an ArcGIS Server 9.3.1 instance with version 10 Desktop. This is the reason why I have a laptop on my desk running 9.3.1.   :(

    Basemap Layers are awesome. They give a cached map service feel to your basemap layers in ArcMap. They're not as smooth as I would like, but they are still way better than regular layers.

    Most of the windows are dockable know which can easily be hidden and shown without a map refresh.

    These are just a few of my first impressions. Anyone else out there running 10? What do you think of it?