Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
http://www.paolocorti.net/2008/06/06/spatial-database-for-postgres-and-...
Thinking in GIS
a blog about GIS from a urban geogeek living at the countryside Feed, Categories, Archives
1 of 9
03-Feb-13 11:55 AM
http://www.paolocorti.net/2008/06/06/spatial-database-for-postgres-and-...
the magnificent ArcObjects code that Abe Gillespie wrote to implement its first zigGis version (0.3 if i don't remember badly). The code Abe wrote was really a wonder at my eyes: a completed PostGis Workspace implementations developed from scratch by using ArcObjects in an extreme, original and not at all documented way (at that time, but maybe even now). To get an idea, here is how looks the code to add a PostGis layer in ArcMap using the zigGis library:
'Create PostGisWorkspaceFactory Dim wksf As IWorkspaceFactory Set wksf = New PostGisWorkspaceFactory 'Open the PostGIS Workspace from a from IPropertySet (in the SDEWorkspaceFactory fash Dim ps As IPropertySet Set ps = New PropertySet With ps .SetProperty "server", "localhost" .SetProperty "database", "TUTORIAL" .SetProperty "user", "psqluser" .SetProperty "password", "psqluser" .SetProperty "port", "5432" 'specify the configfile property if you want to log zigGis actions for debugging '.SetProperty("configfile", @"C:ziggisZigGislogging.config") End With Dim ws As IWorkspace Set ws = wksf.Open(ps, 0)
'Alternatively you can open the PostGIS Workspace from a zigFile 'ws = wksf.OpenFromFile(@"C:ziggisZigGisexample.zig", 0);
'Create the new layer (default renderer is ISimpleRenderer) Dim layer As IFeatureLayer Set layer = New PostGisFeatureLayer Set layer.FeatureClass = fc layer.Name = fc.AliasName
'Add the layer in ArcMap focus map Dim pMxDoc As IMxDocument Set pMxDoc = ThisDocument pMxDoc.FocusMap.AddLayer layer
(more samples here) So I just fell in love with that project, and as far Abe had no time to keep it in life because of other works he was heavily involved in, I decided to inherit its work and to keep it in life. Almost at the same time, also Bill Dollins, one of the most experienced GIS people I have ever known, joined the project, and together
2 of 9
03-Feb-13 11:55 AM
http://www.paolocorti.net/2008/06/06/spatial-database-for-postgres-and-...
we released zigGis 1.0, the first zigGis version with an installer. Quickly other versions came out, until zigGis 1.2, the first version massively installed by the community (almost 5,000 downloads). One big thing was missing then: zigGis was read only, and for editing data you needed to go out from ArcMap and go straight with some OS alternatives like QGIS, gvSIG or uDig. Abe rejoined the project, and a lot of development time was spent for implementing editing and make zigGis performance much better. Now zigGis 2.0 is out, giving the user a full GIS experience with PostGis in ArcMap. Having talked about the release of ArcSde for Postgres and of zigGIS 2.0, let's give a close look at some kind of combinations you can adopt for storing GIS data in Postgres and access them by ArcGis Desktop. The typical every day Esri user may very possibly not ever heard about Postgres and PostGis. In a few words you can consider the Postgres/PostGis combination an Open Source equivalent of the xRDBMS/ArcSde product (where x=Oracle, SQL, DB2, Informix). Now, at ArcGis 9.3 release, the x in xRDBMS will also host Postgres. I would say that when ArcSde for Postgres will be out (soon), there will be at least four ways to go for using Postgres in ArcGis Dekstop: 1. Using ArcSde for Postgres storing data as Esri geometries (Esri-centric with Postgres view) 2. Using ArcSde for Postgres storing data as PostGis geometries using the Esri Geodatabase model (Esri-centric hybrid view) 3. Using ArcSde for Postgres storing data as PostGis geometries using the OGC Simple Feature model (PostGis-centric hybrid view) 4. Using PostGis on Postgres with zigGIS (PostGis-centric view) (3) this is the combination that Bill is currently showing in his blog. I will go now more in details on what you get and what you loose by chocing each of this combination. Note that I am going in an Esri-centric to PostGis-centric order. Note once more that what i am writing here is based on my understanding, as far as i could not try ArcSde for Postgres: so if some of you has some correction to show, drop a note in the comments please. 1. Using ArcSde for Postgres storing data as Esri geometries (Esri-centric with Postgres view) Go with this if you: need Geodatabase goodness (domains, subtypes, networks, etc...) want store raster in the Geodatabase want use versions, (long transactions) want to read and edit the Geodatabase only using Esri software like ArcGis Desktop (with a minimum of an ArcEditor license if you need to edit data) want to serve GIS data on the web only by ArcGis server (until someone will write the 9.3 bindings for MapServer, GeoServer and so on) don't need the powerful PostGis SQL Spatial Functions and you are going to do everything by Esri clients and ArcObjects (though maybe Esri is going to provide its own implementation, like they recently did for Oracle and SQL Server not sure about this) 2. Using ArcSde for Postgres storing data as PostGis geometries using the Esri Geodatabase model (Esri-centric hybrid view) Go with this if you: need Geodatabase goodness (domains, subtypes, networks, etc...) want store raster in the Geodatabase want use versions (long transactions) want to be able to read data with major Open Source clients (QGIS, uDig, gvSIG, MapServer,
3 of 9
03-Feb-13 11:55 AM
http://www.paolocorti.net/2008/06/06/spatial-database-for-postgres-and-...
GeoServer, FeatureServer and many others). You will need at least an ArcView license for reading data with Geodatabase goodness (ie: to navigate relationship class) want to edit with an ArcEditor license (with the other clients you would surely compromise the Geodatabase structure) want to serve GIS data on the web by ArcGis server or by any important OS map server (MapServer, GeoServer and so on) want to use PostGis SQL Spatial Functions (but without doing INSERT, UPDATE and DELETE operations otherwise you would still destroy the Geodatabase structure) 3. Using ArcSde for Postgres storing data as PostGis geometries using the OGC Simple Feature model (PostGis-centric hybrid view) Go with this if you: dont' need Geodatabase goodness (domains, subtypes, networks, etc...) want store raster in the Geodatabase want use versions (long transactions) want to be able to read and write data with major Open Source clients, if not using versions (QGIS, uDig, gvSIG, MapServer, GeoServer, FeatureServer and many others). want to edit in ArcGis desktop with an ArcEditor license want to serve GIS data on the web by ArcGis server or by any important OS map server (MapServer, GeoServer and so on) want to use PostGis SQL Spatial Functions, if not using versions (including INSERT, UPDATE and DELETE operations) 4. Using PostGis on Postgres with zigGIS (PostGis-centric view) Go with this if you: don't need Geodatabase goodness (domains, subtypes, networks, etc...) don't want store raster in the Geodatabase don't want use versions (long transactions) want to be able to read and write data with major Open Source clients (QGIS, uDig, gvSIG, MapServer, GeoServer, FeatureServer and many others) want to read and edit data with an ArcView license via zigGIS, saving the costs for ArcEditor and ArcSde licenses want to serve GIS data by any important OS map server (MapServer, GeoServer and so on) want to use PostGis SQL Spatial Functions Now many points are obvious, but I need to clarify some of them, specially for PostGis users not knowing what you will get adopting the Esri GeoDatabase implementation. Considerations if you are already a PostGis user First: what you get if you use ArcSde? You will be able to store your GIS data in an RDBMS like Oracle, SQL Server, Informix, DB2 and Postgres (from 9.3). Possibly Postgres, if you are reading this post ;-) The geodatabase is able to contain three dataset types: Feature classes Raster datasets Tables Regarding feature classes, you may opt to use some of the Esri Geodatabase Model benefits, like: Feature datasets Subtypes
4 of 9
03-Feb-13 11:55 AM
http://www.paolocorti.net/2008/06/06/spatial-database-for-postgres-and-...
Attribute domains Relationship classes Topology Network datasets Geometric networks Terrain (TIN) Address locator Linear referencing Versioning for more info you may look the ArcGis documentation. Keep in mind that doing so you are highly tied to the Esri suite. In fact the geodatabase model is managed at server side level by ArcSde with a lot of metadata tables and stored procedures in the database, that keep track of all of this stuff, and at client side (for example from ArcMap) by the ArcObjects API. The model is very powefull and gives the developer and even the analyst a lot of GIS out of the box benefits, but - being based on this Esri structure - you are then forced to use Esri software for accessing the data. For instance, if you have created a relationship class between two feature classes, you will need ArcMap or some other ArcObjects application to navigate the relationship or to edit it. Considerations if you are already an ArcSde user PostGIS will let you store data in the Postgres RDBMS. You can store Feature classes and Tables according to the OCG Simple Feature implementation. There is still not the possibility to store raster, but my opinion is that rasters should be better stored in the filesystem than in a RDBMS (well, it is just my opinion of course). And as far as Open Source software evolves quickly, it is even possible that a solution for storing raster in PostGis will be soon available. You obviously cannot use the GDB features: if you need them you have two options: 1)use ArcSde for PostGIS (only from 9.3, of course); 2)write the logic of your model by using Postgres objects or by coding it in your application (instead than in the data). If you opt for the first solution, be sure to read this Bill Dollins post about it. It is a very good solution for taking in your organization other cool Open Source software, desktop clients like uDig, QGIS, and gvSIG (you will be able to effectively read and edit data with them), and outstanding (and free!!!) server products like MapServer, GeoServer, FeatureServer and SharpMap. If you still would like to use PostGis from within ArcGis desktop but you can't afford the ArcSde and ArcEditor licenses, zigGis could be the way to go. But if that is your choice and you miss the intelligent data (GDB), how can you obtain similiar GDB behaviours in PostGis? Well, mostly is just a question to use some DDL, Postgres SQL and PostGis Spatial SQL. For example: GDB Subtypes: Postgres Primary and Foreign Keys. and some triggers if you want to differentiate behaviour for each feature class subtype. But ArcMap won't display the different subtypes in the TOC, you may obtain this only by customization GDB Attribute Domains: Postgres Check Constraints. But ArcMap won't show you the combobox in the edit data form. Again: you may obtain this only by customization GDB Relationship Classes: Postgres Primary and Foreign Keys, with cascade behaviour. Trigger with spatial SQL for spatial relationship. ArcMap won't show the relationship, only if customized GDB Topology: Postgres triggers with spatial SQL. The topologic dataset will be updated in ArcMap as soon as the triggers fire and the map is refreshed GDB Network Datasets: Postgres triggers with spatial SQL. The network connectivity rules can be implemented from ArcCatalog with customization
5 of 9
03-Feb-13 11:55 AM
http://www.paolocorti.net/2008/06/06/spatial-database-for-postgres-and-...
GDB Geometric Network: Implementable like for network datasets Fot this time is all, I hope i could clarify some points to you. Disclaimer: I still couldn't directly test ArcSde for Postgres 9.3 (and not sure I can ever be able to), and i am one of the zigGis developers.
Like
Showing 14 comments
Paolo, This is an excellent write up. Thanks for sharing. Will be sure to check out zigGis for any future projects that may require the ArcGIS/PostGIS combo. --Andres
Excellent article :-) I've tried a little bit the demo version of ZigGIS 2.0 and I'm surprising of the capabilities: multi-user editing functionalities are impressive :-0 For my (little) experience, ArcMap is necessary for a bunch of important functions (like advanced editing and plottings) that gvSIG (the best OS Desktop GIS AFAIK) don't implement at this time, so ZigGIS looks extremely useful to maintain a OpenSource architecture (like PostGIS+GeoServer+gvSIG) without lose any advantage (using ArcGIS only when I really need).
6 of 9
03-Feb-13 11:55 AM
http://www.paolocorti.net/2008/06/06/spatial-database-for-postgres-and-...
Great article; I look forward to sharing it with some of our clients wondering what the best mix will be for them. Great work, Brian
Great article Paolo. But I guess you've heard a lot of that already. Still need to kick my zigGIS install around. Hopefully I'll be able to in the coming weeks. I guess the only thing I see charming about the ArcSDE is the raster part and even that is questionable if there is no easy way to query it except via ArcGIS tools. My main reason for that ironically is because of firewalls. The DMZ for example can hit the database but things like rasters are a pain since they need to be uploaded to the website. Has anyone tried storing rasters in PostGIS with ArcSDE?
Thanks to all of you, glad that you liked it! :D @Diego: ArcGis desktop excels not only at Plotting and Editing, but also has a lot of spatial analysis functions that are still not integrated in the other desktop GIS. Just think of the ArcGis extensions: there are a lot of GRID, TIN, Network and Geostatistic functions out there ;-) @Regina: I agree on your doubts about raster. The DMZ issue is effectively something that could
7 of 9
03-Feb-13 11:55 AM
http://www.paolocorti.net/2008/06/06/spatial-database-for-postgres-and-...
be effectively solved by loading the raster in the RDBMS. But are you sure that copying the images to a RDBMS in the DMZ would make so much difference in respect of uploading the images to a filesystem in the DMZ? (this i guess could depend heavily in the internet protocol you are using to access the file system).
@Regina: ok, i read again your comment. Looks like your RDBMS is out of DMZ, but the port is open so web server can query it. In this case, yours is a good point, and i cannot be helpful to you.
Paolo, Excellent summary all around. The introduction of ArcSDE to PostgreSQL definitely will create some interesting technology mixes. Many folks who were locked in before will get to experience PostGIS and may just begin to wonder. Tom Waits once did a song that started with the line "Small Change got rained on with his own .38" .... @Regina. I did do a quick test of loading rasters into ArcSDE on PostgreSQL and creating a raster catalog. Seemed to work like it does on the other platforms. I will discuss that in my next post but I've had a deadline pressing so it's had to wait. Bill
Nice to hear that. I wait with baited breath. Its nice to know others have listened to Tom Waits. Haven't heard his songs in a while though.
8 of 9
03-Feb-13 11:55 AM
http://www.paolocorti.net/2008/06/06/spatial-database-for-postgres-and-...
Bill, the sense of that song's words is not very clear to me, but I also like Tom Waits, whatever he is singing there :D
It's more the idea that, by supporting PostgreSQL, ArcSDE may lead people not otherwise inclined to an open-source platform where they may begin to question other technology choices. I guess the key part is "with his own .38". :) @Regina. It had been a while for me too but he snuck onto my iPod recently.
Powered by Blogofile. Some right reserved by Paolo Corti RSS feeds for Entries and Comments.
9 of 9
03-Feb-13 11:55 AM