Thursday, September 22, 2011

Setting LM_LICENSE_FILE Environment Variable for ENVI/IDL 4.8 on Pre-Lion MacOS

To set an environment variable for ENVI/IDL on a pre-Lion MacOS System, I would recommend using the environment.plist file. This persists through whatever shells you have installed as well as in X Windows (and therefore when you double-click the ENVI executable from the MacOS GUI). I did not find any correct documentation for doing this from ITT or NASA.

1. Install the software
3. Define the environment variable in the file ~/.MacOSX/environment.plist
----- Open the Terminal
----- You will probably have to create the directory ... mkdir ~/.MacOSX)
----- ... and the file vi ~/.MacOSX/environment.plist

Paste the following into vi in Insert mode (press i) and save (:x) ... if you have more than one environment variable, make sure to add another key/string pair ... make sure you subsistute PORT and HOST below

<!--?xml version="1.0" encoding="UTF-8"?--><!--?xml version="1.0" encoding="UTF-8"?-->
<plist version="1.0">
<dict>
<key>LM_LICENSE_FILE</key>
<string>PORT@HOST</string>
</dict>
</plist><plist version="1.0"><dict></dict>
</plist>


4. Close terminal

You should now be able to use ENVI/IDL.

Thursday, September 1, 2011

Openlayers Geoserver WMS Caching with GWC

Now that Geowebcache is integrated with Geoserver and WMS (among other OGC service types), map tile-caching is supposed to be really simple. I found this not to be the case. Among other challenges, document is lacking or blatantly wrong. Here are a couple key concepts that I learned the hard way:

Use the demo from the Geowebcache section (http://localhost:8080/geoserver/gwc/demo) NOT the regular OL "Layer Preview" which does not use the correct gridset parameters (nice demo, eh?)


Issues I was having with labeling and tiles are mostly solved by creating a database view from the centroids of polygons to be labeled and label these instead, and include in a layer group.

Don't use the "Recycle Tiles" option ... especially if you don't have native JAI. This causes a memory leak and subsequently causes the server to crawl/crash after X requests. Also you probably shouldn't tweak max render time/memory unless you have to (despite documentation saying that this helps performance ... would this be helpful at another time? I don't know).

Despite documentation saying to use the wms endpoint and that no special endpoint is needed ... a special endpoint is needed ... it's of this format http://host:8080/geoserver/gwc/service/wms

The gridset scheme is static and opaque, unless a custom config file is created. The documentation gives the impression that the integration of WMS/GWC creates arbitrary gridsets given wms grid request characteristics. One could could create their own geowebcache.xml (saved to GEOSERVER/webapps/WEB-INF/geowebcache.xml ... though there is some confusion about that). See more about geowebcache, the gridset schema, and geowebcache.xml here

Don't pass anything on the wms request that you don't have to! Forums and documentation say that you need to pass things like tilesOrigin, which will cause the request to fail most of the time.

GWC saves tiles to your data directory under the gwc folder. You should check here to make sure tiling is working.

Wednesday, August 24, 2011

Lookbehind/Lookahead Assertion with Npp Regex

Today I was looking for a way to get the last character of a pattern so that I could replace it. In this example, I wanted to find the last pipe in a record like 8|34346|. Normally with regex, one could do this using a lookbehind assertion. To do this with notepad++ you must utilize the implicit search buffer, by using a \1 in the replace field (for example, to access the first set in the buffer).

So by searching on: 1|10007|someemail@someplace.com|lastname,first name|X

"Find What:" ([0-9]*[|][0-9]*)[|]
"Replace With:" \1%

I could get: 1|10007%someemail@someplace.com|lastname,first name|X

BIG THANKS TO DEAN NAIRN!

Wednesday, August 3, 2011

Lay Interpretation of Cancer Incidence


Cancer is a big deal, and the potential environmental factors make mapping incidence very appealing. This has made maps a handy device for newspapers and other "lay" interpretations, which typically don't employee rigorous statistical tests for significance. Victor Perez, a researcher at UD wants to investigate the ways cancer incidence is discussed in these lay publications. As a discursive preliminary step in this study, Dr. Perez asked me to help him prepare a map that would show what a random incidence of cancer cases might look like. To do this I used the "generate random points" tool using data on census tracts (Total Population from Census 2000) and given average Delaware cancer incidence.

Wednesday, July 27, 2011

SDE Errors

"ERROR: ESRI: error getting spatial references for srid = "

... uses public.sde_spatial_references instead of sde.sde_coordinate_systems, so cannot use standard srid ... only have a selection of srid's of loaded features ... therefore use srid defined in public.sde_spatial_references


"DBMS table not found xxx State ID = 9"

... was getting this error after the SDE had become corrupted b/c client was using PG Admin instead of ArcGIS Desktop to do schema changing operations (deleting tables). Clearly these actions should be done with Desktop in the future (Catalog). To fix this I deleted the SDE and reconfigured with the SDE Post-Installer. This may also be fixable using
sdetable -o unregister
or some switch combo on sdegdbrepair

Error in event viewer:
FATAL: bogus data in lock file "postmaster.pid": ""
resolve by deleting the postmaster.pid file

Postgres Error Codes: http://www.postgresql.org/docs/9.3/static/errcodes-appendix.html

Deciphering Errors within ArcSDE
http://blogs.esri.com/esri/supportcenter/2011/09/22/deciphering-errors-within-arcsde/

Tuesday, June 28, 2011

ArcSDE/Postgres Error 000210, Could not Copy Features

It seems like there is an out of the box error in ArcSDE which causes geodatabase operations like Import Feature to fail out of the box (giving a 000210 error, Could not Copy Feature). In my case, it was because my db user name "postgres", which is usually a default, was not included as a schema in the deafault database. This might be solved by calling the user "sde", but in my case I solved it by simply creating a new schema in the default database beside the existing sde schema.

Tuesday, June 14, 2011

postgres max integer in an alphanumeric column

select max(to_number(substring(COLUMNNAME from '([0-9].*)'),'99999')) from TABLENAME

removes letters from a mixed column ... can be used for generating a new id