Thursday, May 08, 2008
Posted on Thursday, May 08, 2008 10:36:07 PM (Mountain Daylight Time, UTC-06:00)  Comments [6] | 
Categories: ArcSDE | PostGIS

So my company is sending me out to Where 2.0 - I've never been and expect it will be quite different from many of the other GIS conferences I've been to - more MacBooks and soul patches I'm guessing.

I'm particularly excited about the pre-conference workshops, as it will be a chance to get the low down on some technologies I have not worked with in the past.  I'm hitting the Geo-ify your Web Site session in the morning (Mapstraction) and the The Open Geo-Stack: OpenLayers, GeoServer, PostGIS session in the afternoon.

In prep for the workshops I thought I'd get PostGIS (with ArcSDE 9.3 beta) installed on my notebook - ideally I'd like to roll into the session with a little background so I can ask relevant questions!

Installing Postgresql + PostGIS + ArcSDE 9.3 (beta)

Overall, not exactly the smoothest installation I've ever done. No step was particularly difficult, there were just points where I had to do some head scratching, Googling and then "just do it". I have to give ESRI credit as the ArcSDE installer was smooth as silk, and they included Postgresql 8.2 on their media. However, having not used PostGIS before, exactly how this fits into the mix was a little unclear. I will say that if you have used ArcSDE in the past, and just want to get rolling without paying for a database - the install is really pretty easy.

As noted, I installed PostgreSql 8.2 directly from the 9.3 beta media - this is super simple. I then downloaded the PostGIS Installer for PostgreSql 8.2. Again this was pretty easy, after you locate and download it. As per the ArcSDE instructions, I then ran the ESRI post installer, authorized ArcSDE and all looked good.

I could immediately connect to the sde database as the sde user, and used ArcCatalog to load a shapefile into PostGIS. Smooth.

But how do I know that this is actually using "PostGIS"? Would this data be accessible to non-ESRI clients?

Enter uDig. This was a quick and painless install, and uDig was installed.

When I browsed to my local PostGIS server, things were not looking good.

image

Where was my data? Clearly something is not lining up here. When I tried to connect to ArcSDE via uDig (after I located the jar files) it could not connect. Not sure if this is related to using the beta 9.3 jar files, or something else.

Anyhow, I decided I should try loading the same data via the command line post gis tools. Here I ran into a bit of a wall. The documentation for the PostGIS tools is not bad, but certainly aimed at the unix sys admin type of person. The basic process is to convert your shapefile into a Sql file, and then run that in Postgresql. Seems simple. A quick little batch file ought to work this right out. The sql file was created just fine, but it failed to load.

Sorting this out really meant it was time to do a little learning about Postgresql. After sorting out schemas, and learning that the most likely encoding of my shapefile was "LATIN1" I was able to load my data and "see" it in uDig.

image

Actual loading the layer into uDig never completed. The application just sort of hung stating that the "Project command" was executing. This was just a map of all the counties in the US, so not sure what the issue was, but I'm pretty sure it was my fault.

I then tried to connect via ArcCatalog to see if I could "see" this layer... and not too surprisingly I could not.

Summary

Thus far I've simply come to realize that I have a lot to learn. I need to grok a lot more about Postgresql and PostGIS to start, and then add ArcSDE into the mix. I'm sure that if I read more of the ESRI documentation I'll find some answers, but at this point it's unclear to me if they will be supporting direct access to PostGIS data, or if they will be supporting the PostGIS spatial format for data stored in traditional ArcSDE schemas (i.e. with all the GDB_ and SDE_ tables). I also learned that I've been sheltered from the reality of "data" for many years!

I'll continue this series as I make progress getting things sorted out.

Friday, May 09, 2008 1:58:41 AM (Mountain Daylight Time, UTC-06:00)
Hi, it will be interesting to read what you find out. From others I have got the impression that ESRI first of all implements their own model in PostgreSQL (i.e all the ArcSDE schemas) and that one optionally may store data in the PostGIS model. Much like how they treat storage in Oracle Spatial. But I am not an expert here and may be very wrong.

Cheers,
Pål Herman
Sandefjord/Norway
Pål H
Friday, May 09, 2008 6:57:45 AM (Mountain Daylight Time, UTC-06:00)
It looks like you have to use the PostGIS creation template to be able to directly access PostGIS data. From the 9.3 help:

http://webhelp.esri.com/arcgisserver/9.3/dotNet/index.htm#geodatabases/using_th485132809.htm

===============
Preparing your database to use PostGIS geometry

To use the PostGIS geometry type in your geodatabase, your database must be enabled to use the PostGIS geometry type. To do this, you must create the database using the PostGIS template database that was created when you installed PostGIS.
================


Ron
Ron Bruder
Friday, May 09, 2008 8:21:27 AM (Mountain Daylight Time, UTC-06:00)
I found the Boston GIS article here helped me navigate alot of the PostGIS detail:
http://www.bostongis.com/?content_name=postgis_tut01#20
Brendan
Friday, May 09, 2008 9:19:46 AM (Mountain Daylight Time, UTC-06:00)
You also may want to try the latest release of PostgreSQL which is 8.3 and the latest version of PostGIS, 1.3.3. These later releases might smooth out the process. At any rate, I'm looking forward to hearing about your experiences with it and SDE.
Friday, May 09, 2008 10:49:47 AM (Mountain Daylight Time, UTC-06:00)
I never really liked the SQLquery approach to upload to shapefiles. Which is why I way back created this little tool. It also used WKB which should be a little faster (note: the shapefile reader I used back then wasn't that bullet proof)
Friday, May 09, 2008 4:37:16 PM (Mountain Daylight Time, UTC-06:00)
We always use the ogr2ogr command line tool (with a template text-file) to insert shape and tab files into our PostGIS database. That isn't too hard, and the results reliable. The tables are inserted directly into the schemas and tables you write in the line - no sql query files in your hand. Haven't found an occasion (our data is often in MapInfo) to try Mortens tool, but it seems fine.
Karl
Comments are closed.