Bending the Rules Again
In my last post I mentioned a way to get distinct values for a featureclass out of ArcIMS. This involved bending the rules 'creatively', but it got the job done which was the ultimate intent. Recently I was discussing with some colleagues another frustrating issue with ArcIMS; namely, that of stacking an ArcIMS image on top of (or below) a WMS image. Since ArcIMS has no native WMS client capabilities, we're always forced to stack the images in the browser. This can have some unfortunate side effects - partially transparent polygons become opaque, and antialiasing goes straight out the window. Observe:
This is the standard Geocortex IMF demonstration site, with the USGS Shaded Relief WMS dropped behind. Notice the absence of image behind the jurisdiction layer, the poor antialiasing of the roads over the shaded relief, and the barely legible "Gaston" label.
Now, we can't make ArcIMS become a WMS client, but we *can* work around these issues if absolutely necessary. What happens from the IMF perspective when we generate this image is that it requests the WMS image from USGS, and at the same time requests the ArcIMS image. It then drapes one over the other in the user's browser. If we changed the workflow a bit, we can do the following:
- Request the WMS image
- Save the WMS image somewhere the ArcIMS server can get it
- Add an acetate layer to the ArcIMS map with a single polygon. This polygon will cover the same area as the current map extent, which will also be the same area covered by the WMS image.
- Use a RASTERFILLSYMBOL to paint the polygon, and use the WMS image as the source.
Using this trick, our image now will look like this:
Ahhhh, much better!
Note that I did take the liberty of changing the symbology slightly for the jurisdictions layer to work well with the WMS, but you get the idea :)
Bending the Rules
After working with ArcIMS for 7 years, I've learned to accept some limitations. Sometimes though, requirements dictate that we "bend the rules" a bit. One recent challenge was to determine the distinct values for a field in an ArcIMS layer. Since ArcIMS queries have no "distinct" clause, we had to get creative. Here are the two options we came up with:
- Query for a bunch of records (say, 50). Get the unique field values from those 50, and query again, this time filtering out records that are NOT the ones we've just found. Repeat until you get no new records from ArcIMS or until you have more records than you can handle, whichever comes first.
- Formulate a special WHERE expression, in the form OWNER.SCHEMA.TABLE.OBJECTID IN (SELECT MAX(OBJECTID) FROM TABLE GROUP BY UNIQUE_FIELD). A real-life example that can be used on our Geocortex IMF Demonstration Site (try the query builder on the Geocode Streets layer) is: SDE_CHAR_VMB.SDE_CHAR_VMB.CNTY_STREETS_V.OBJECTID IN (SELECT MAX(OBJECTID) FROM CNTY_STREETS_V GROUP BY SUBDIVISIO)
The first option is the only possibility for shapefile-based data sources, and for SDE data sources with non-unique OBJECTIDs. I'm partial to the second one though because it takes only one query, it's very fast (even for finding the 200 unique values in layers with hundreds of thousands of features), and it showed me that subqueries in WHERE expressions to ArcIMS are possible.
I'm curious to see what other clever things can be done with ArcIMS using sub-queries...