Skip to main content

Posts

Showing posts with the label ArcGIS

Making Code Samples Readable Online

After lazily just pasting code in <pre> blocks for years, this morning I finally got around to researching a code highlighter like you see on almost all the programming websites. Thanks to SyntaxHighlighter adding this feature was embarrassingly easy. It is self-contained javascript that works on a pre or script tag decorated with a html class calling a brush alias, e.g. <pre class="brush: sql"> INSERT INTO MyWebsite (pre, script) VALUES (complete, awesomeness) </pre> Oh, but it's not just SQL, no there's a whole easel of brushes included: Brush name Brush aliases File name ActionScript3 as3, actionscript3 shBrushAS3.js Bash/shell bash, shell shBrushBash.js C# c-sharp, csharp shBrushCSharp.js C++ cpp, c shBrushCpp.js CSS css shBrushCss.js Delphi delphi, pas, pascal shBrushDelphi.js Diff diff, patch shBrushDiff.js Groovy groovy shBrushGroovy.js JavaScript ...

Repairing Broken Data Sources

What do you do when you open your map and you have a layer that looks like this? What does it mean? The red exclamation point is a visual indicator that something is incorrect in the layer's data source.  To fix it you'll need to know where the data lives and tell the layer in the map this information.  You're giving direction to poor lost layer so it can find itself, you're a metaphysical geographer!  Repairing a data source: Right-click on the layer, from the contextual menu choose Properties In the Properties dialog box choose the Source tab Click Set Data Source Browse to the location of the data layer, select and click Add OK out of the Properties dialog If all went well your data is now displayed. But what if it isn't one layer?  What if you have an entire map of mis-pathed layers? Here's where ArcCatalog comes to the rescue: Locate the map in ArcCatalog Right-click and select Set Data Source(s)   Highlight one of the Data Layers ...

Forming a New Reality

This post is part of an ongoing series Design for Exceptions Spreading the Sheets and Letting Relations In Forming a New Reality There's more to come... we're starting simple and working up... this will slowly become more complex to include SQL Server, ASP.Net web apps and ArcGIS. Download the MS Access 2007 Project used in this post. Now that we have our relationships all set up creating usable edit forms in MS Access 2007 is ludicrously easy. Creating an Edit Form in MS Access in Four Satisfying Steps: Open Beer, Open Access Project Highlight the table for which you want to create a form (let's start with Cities) Click the Create Tab, Select Form Press Save, Sip Beer I'm not kidding. It is that easy. Here's my form (sips beer) Repeat four steps for ZipCodes: Wow! We are amazing. What else is there to do? (sips beer) And that's the problem here, we're just sitting around sipping beer. This isn't real data. Well, it is real data, but it's a t...

Spreading the Sheets and Letting Relations In

This post is part of an ongoing series Design for Exceptions Spreading the Sheets and Letting Relations In Forming a New Reality There's more to come... we're starting simple and working up... this will slowly become more complex to include SQL Server, ASP.Net web apps and ArcGIS. In my last post I went off on relational database design patterns. Now let's try implementing these patterns in MS Access. Download the MS Access 2007 Project used in this post. In the old days we made spreadsheets. And they got ugly really quick. Let's work with our city-zipcode analogy from last time . We started with what is basically a spreadsheet in MS Access: We outgrew this quickly when we added Meridian: I didn't mention this in my last post, but I see this all too often. Basic database design cue, if you're numbering your columns your design is wrong. Why? Boise has 29 zipcodes. New York has 161. Washington, DC has 278. Do you really want 278 columns for storing zipc...

Design for Exceptions

This post is part of an ongoing series Design for Exceptions Spreading the Sheets and Letting Relations In Forming a New Reality There's more to come... we're starting simple and working up... this will slowly become more complex to include SQL Server, ASP.Net web apps and ArcGIS. One of the biggest mistakes I run into every day is databases and spreadsheets which weren't designed for the exceptions. I get it, most of your data fits in your model. But then you run into data that doesn't fit your world view and you call me. And that's when things get ugly. We need an example. Let's use ZipCodes. We all know how these work right? Each city has a zip code. Here's some examples from here in Southwest Idaho: City ZipCode Eagle 83616 Kuna 83634 Idaho City 83631 That wasn't so hard was it? Our spreadsheet is done! Not so fast cowboy. What do we do with Meridian? It has three Zips: 83642, 83646, 83680. You've seen this before though and you got it t...

An Inquiry into IN Query

I had to select a ton of records today for a project in ArcGIS. You know the normal method, hellish SQL repetition: ID = 1 OR ID = 5 OR ID = 6 OR ID = 12 OR ID = 14 OR ID = 27 OR ID = 41 OR ID = 43 The past few months I've been working a lot in SQL Server and this experience made this repetition seem like too much work. So I got lazy and I made an inquiry into IN query: ID IN (1,5,6,12,14,27,41,43) And it just worked. There's no documentation in the main help file that even mentions it. If you do open the ArcGIS Help and search on "SQL Reference" nearly half way down you find a section on Subqueries. Here they explain that IN queries are supported in geodatabases and EXISTS is supported as well! Who knew? How was I supposed to know this if I hadn't gotten lazy? Here's what you'll find in the ArcGIS Help File: Subqueries NOTE: Coverages, shapefiles, and other non-geodatabase file-based data sources do not support subqueries. Subqueries done on a v...

Restoring Orphaned SQL Server 2008 Users

We keep moving databases across servers and reinstalling SQL Server at my office. Almost everything transitions perfectly except SQL Server Users. Unless the user already exists in the Master Security table, the database user is left orphaned inside the database without the ability to perform any useful function. Like you right now, but we're gonna change that. Here is an example, note how there is a User Name but no Login Name. User Name but no Login Name Step 1: Recreate the User in Master First, if they don't already exist, is to recreate the user in the master database by browsing to the root level Security folder in SQL Server Management Studio, choose Logins and right-click create user. You tried to check the database database under the "User Mapping" page didn't you? Create failed for User 'UserName'. That was a good idea hotshot, but it ain't gonna work for you. Just create the user and Ok your way out of there. Time for Step 2. Step 2: ...

Translating Coordinates

Of all the GIS questions I field, coordinate system related questions are the most frequent. The following is typical: I got a shape file of land parcels from Bonneville Co. and am trying to overlay that onto the County NAIP imagery. For some reason, when I have the same coordinate system and datum assigned to all layers, the NAIP and shape files are projecting at different scales and not even coming close to lining up. I’ve tried everything in my limited arsenal. If you have any idea of what’s going on, please let me know. The problem here is not a lack of understanding of the software (or grammar), but misunderstanding concepts behind assigning and translating a coordinate systems. Translate This I've found language translation to be the most accurate analogy for making sense of coordinate systems in ArcGIS. Suppose you're traveling on a ferry in the Baltic Sea (why not?). A frazzled tourist is running from person to person animatedly asking a question. Fortunately, you ...

Simple Record-Level Auditing in SQL Server & ArcSDE

I've had simple auditing set up in my databases for years thanks to our old DBA. This is not robust transaction logging, it just answers the questions "Who created this?", "When was this created?", "Who last edited this?" and "When was this last edited?". After witnessing a brand new table audit itself without triggers, I set about to understand the setup. This seemed curious to me, so I thought it might also be curious to you. It turned out to be a two step system which rendered my insert triggers superfluous (at least I think so, tell me if I'm missing something and I need insert triggers after all). Our solution uses a combination of two methods. For inserts we are going to tie our audit fields to User Defined Data Types which inherit Defaults we have specified. For updates we will build a trigger to log the changes. We will use the following fields in our tables to track inserts and updates: AUD_NUser - Creator AUD_NDate - Creati...

Making Copies with a HP DesignJet 5000ps (Queue Management)

At my old job making copies on the plotter was a piece of cake. You went into the Queue, selected the job and number of copies and presto! For some reason, possibly because I hardly make paper maps anymore, learning queue management on the DesignJet 5000ps did not come intuitively. My latest map kept running out of memory on the plotter, so when it finally did print after spooling for three hours, I had the incentive I needed to explore the DesignJet 5000ps menus. I must admit that I have waited five years and wasted the total of several days spooling print jobs. It isn't even complicated. Starting at the Main Menu (use "Top" key to make sure you are at the Main Menu) Press the "ENTER" button (this will select the first option "Printing") Highlight "Queueing & Nesting..." and press "ENTER" Highlight "Queue Management" and press "ENTER" Highlight the job number (These are negative numbers in the order last ...

Elaborate Hack for Transparency

ArcGIS supports transparency*. &#42 Some restrictions apply. But if you really want to do anything with transparency you quickly learn that the functionality available is completely inadequate. I work with a number of layers that rather than resembling a stain glass window with neatly segmented regions, come closer to resembling the outcome of tossing said window down a flight of stairs. The smashed bits all laying in a pile overlapping each other sometimes seven or eight layers deep. But how to represent this mess? In ArcGIS you really can't because ArcGIS only draws the top most layer. Take a yellow piece of stained glass and drop it on top of a blue one and in the overlap you don't get green, but blue. Even when you set transparency! The only way to complete our Glad bag analogy is to make two independent layers with transparency applied. Not bad when there's only two. But what if there's 582? That would take a while. And what if the layer with 582 is con...

Saving Label Expressions

Using the database querying label expressions I wrote about on Thursday, I got to learn a new "feature" of ArcGIS today: Disappearing label expressions on modification of a definition query That's right, spend five minutes building a database query into your label expression, get it working perfectly and then to celebrate try limiting it with a definition query. Bam! No more label expression. Ain't ArcGIS beautiful? In dealing with this "feature", I discovered ArcGIS has the ability to Save and Load label expressions. I'm quickly developing a catalog of label expressions.

Copy Error Messages to Clipboard

Don't you just love the error messages with just one prompt, OK, as if you are agreeable to it? ArcGIS is full of them. I'm especially fond of " Memory at XXXX08008878XXX cannot be found. " You know them well. But did you know not only can you copy and paste the error message into a picture editing software such as Office Picture Manager, but you can also use Ctrl-C to copy and paste the contents into Notepad, Word, Outlook or a textbox when updating your blog. --------------------------- License --------------------------- Provide your license server administrator with the following information: Cannot find SERVER hostname in network database The lookup for the hostname on the SERVER line in the license file failed. This often happens when NIS or DNS or the hosts file is incorrect. Workaround: Use IP-Address (e.g., 123.456.789.123) instead of hostname Feature: ARC/INFO Hostname: Ifwis3b License path: @Ifwis3b FLEXlm error: -14,7. System Error: ...

ArcGIS One-to-Many Labeling

ArcGIS is just plain lousy at dealing with any relationship that isn't one-to-one. We all have a slew of hacks just to deal with this limitation. I for one regularly am creating temporary cross-tab queries so I can represent multiple sample results at a collection point, fish surveyed at a cross-section and a host of other relationships. The classic example for mapping comes from the cadastral community and condominium lots. It's an odd situation where more than one person has title to the same piece of ground. How do you represent this? I've got a new trick thanks to Mohammed Hoque's article in ArcUser Magazine. We're going to do a database query inside a label expression, loop through the results and output the entire list to label. For our example we'll use Outfitting Areas in Idaho and we'll label them with the Outfitters and Guide License Numbers and Outfitter Names. 1.) Open ArcGIS and add your spatial layer with the unique identifier shared with...