<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Re: [postgis-users] PostGIS and ADO.NET</TITLE>

<META content="MSHTML 6.00.6000.16414" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=553421716-26042007><FONT face=Arial 
color=#0000ff size=2>          
           
          I believe that WFS-T spec which 
I think GeoServer supports is designed for transactional editing via WFS.  Mapserver 
unfortunately does not support WFS-T to my knowledge. </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=553421716-26042007><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=553421716-26042007><FONT face=Arial 
color=#0000ff size=2>I haven't played around with WFS-T so don't know much about 
it and am not too familar with many client apps that can use it directly 
except for uDig (which can edit PostGIS directly anyway I think but is a Java 
app) and OpenLayers which seems to support WFS-T but can't comment on how good 
that support is.  </FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=553421716-26042007></SPAN><FONT face=Arial><FONT 
color=#0000ff><FONT size=2>T<SPAN class=553421716-26042007>he PostGreSQL ADO.NET 
drivers can manipulate the attribute data easily.  I do that all the 
time.</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=553421716-26042007></SPAN></FONT></FONT></FONT> </DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=553421716-26042007>Are you looking for a web-based editor or a desktop 
editor?</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=553421716-26042007></SPAN></FONT></FONT></FONT> </DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=553421716-26042007>If you are looking to have your users edit data from an 
ASP.NET page and have the ASP.NET page update the database, then one thought 
that comes to mind is to use the WKT driver in OpenLayers (don't know how robust 
it is, but looks like its designed to both read and edit WKT 
data)</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=553421716-26042007></SPAN></FONT></FONT></FONT> </DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=553421716-26042007><A 
href="http://trac.openlayers.org/browser/sandbox/tschaub/wkt/lib/OpenLayers/Format/WKT.js?rev=2902">http://trac.openlayers.org/browser/sandbox/tschaub/wkt/lib/OpenLayers/Format/WKT.js?rev=2902</A></SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=553421716-26042007><A 
href="http://trac.openlayers.org/browser/sandbox/tschaub/wkt/examples/wkt.html?rev=2902">http://trac.openlayers.org/browser/sandbox/tschaub/wkt/examples/wkt.html?rev=2902</A></SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=553421716-26042007></SPAN></FONT></FONT></FONT> </DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=553421716-26042007>Then you can use the AsText() function and 
GeomFromText() functions built into PostGIS to dish out WKT data and consume the 
WKT data.  With that you can get by with just the npgsql ADO.NET driver for 
editing and dishing out selected regions, your mapserver/KaMap for heavy map 
rendering, and openLayers for bridging the 
gaps.</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=553421716-26042007></SPAN></FONT></FONT></FONT> </DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=553421716-26042007>Hope that helps,</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=553421716-26042007>Regina</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=553421716-26042007></SPAN></FONT></FONT></FONT> </DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=553421716-26042007></SPAN></FONT></FONT></FONT> </DIV>
<DIV><BR></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> 
postgis-users-bounces@postgis.refractions.net 
[mailto:postgis-users-bounces@postgis.refractions.net] <B>On Behalf Of </B>Jeff 
Dege<BR><B>Sent:</B> Thursday, April 26, 2007 11:24 AM<BR><B>To:</B> PostGIS 
Users Discussion<BR><B>Subject:</B> RE: [postgis-users] PostGIS and 
ADO.NET<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2><SPAN 
class=273195014-26042007>We've been using OpenLayers to display maps on the 
browser.  It's quickly becoming a very nice ajax-based map engine that can 
interface with a great many map sources.  We've mostly used it with KaMap, 
Mapserver, and shapefiles, but we've interfaced with WMS and WFS servers, as 
well.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2><SPAN 
class=273195014-26042007></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2><SPAN 
class=273195014-26042007>From a quick glance, it looks as if most of the 
interaction with the PostGIS database would be in the mapserver map file.  
Defining layers means defining queries, and all of it is invisible to the 
server-side C# code.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2><SPAN 
class=273195014-26042007></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2><SPAN 
class=273195014-26042007>We're currently looking at an system that basically 
uses a map as a monitoring tool.  The geometry would be fixed, but the 
attributes for each feature would change perhaps once a minute.  We'd 
thought that we might run a program on the server that would write GML files, 
and we'd have the OpenLayers GML layer type to display the map.  Looking at 
PostGIS, I'm thinking we might store the data in PostGIS, run a program on the 
server that would update the attributes, use MapServer to serve the data through 
WFS, use OpenLayers WFS layer type to display the map.  I'm assuming that 
the PostgresSQL ADO.NET drivers would be able to manipulate the attribute 
data.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2><SPAN 
class=273195014-26042007></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2><SPAN 
class=273195014-26042007>But we also have a need for users to edit features - to 
display lines, points, and polygons, to allow the users to manipulate these, and 
to save them - but not in the map data proper, but in a staging area where they 
can be evaluated and approved or rejected prior to being integrated into the 
map.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2><SPAN 
class=273195014-26042007></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2><SPAN 
class=273195014-26042007>Can we do this through WFS?  If so, we might not 
need to access the geometry from the web server code-behinds at 
all.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2><SPAN 
class=273195014-26042007></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2><SPAN 
class=273195014-26042007>Eventually, though, we're almost certain to run into a 
problem where we'll want to have server-side code manipulating geometry.  
</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2><SPAN 
class=273195014-26042007></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2><SPAN 
class=273195014-26042007>I'll look at SharpMap.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2><SPAN 
class=273195014-26042007></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2><SPAN 
class=273195014-26042007>MapScript's C# DLL won't work - it has fundamental 
granularity problems.  The Mapscript DLL is non-reentrant, so the C# 
wrapper does locking to avoid conflicts, and the result works fine at low load 
levels, but doesn't scale.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2></FONT><BR> </DIV>
<BLOCKQUOTE dir=ltr 
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
  <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
  <HR tabIndex=-1>
  <FONT face=Tahoma size=2><B>From:</B> 
  postgis-users-bounces@postgis.refractions.net 
  [mailto:postgis-users-bounces@postgis.refractions.net] <B>On Behalf Of 
  </B>Obe, Regina<BR><B>Sent:</B> Thursday, April 26, 2007 3:05 AM<BR><B>To:</B> 
  PostGIS Users Discussion<BR><B>Subject:</B> RE: [postgis-users] PostGIS and 
  ADO.NET<BR></FONT><BR></DIV>
  <DIV></DIV>
  <DIV id=idOWAReplyText35042 dir=ltr>
  <DIV dir=ltr><FONT face=Arial color=#000000 size=2>Jeff,</FONT></DIV>
  <DIV dir=ltr><FONT face=Arial size=2></FONT> </DIV>
  <DIV dir=ltr><FONT face=Arial size=2>Just wanted to add to what Abe was 
  saying.  Its not entirely true that you have to convert to byte array to 
  use except for updating data.</FONT></DIV>
  <DIV dir=ltr><FONT face=Arial size=2></FONT> </DIV>
  <DIV dir=ltr><FONT face=Arial size=2>SharpMap and ZigGIS do that already for 
  you I think so you can just focus on writing the SQL statements.  Not 
  sure about NetTopologySuite.</FONT></DIV>
  <DIV dir=ltr><FONT face=Arial size=2></FONT> </DIV>
  <DIV dir=ltr><FONT face=Arial size=2>It depends on what you are trying to do I 
  guess.  I've used PostGIS in .NET 2.0 and .NET 1.1. in a number of 
  ways.</FONT></DIV>
  <DIV dir=ltr><FONT face=Arial size=2></FONT> </DIV>
  <DIV dir=ltr><FONT face=Arial size=2>1) With SharpMap - you may want to look 
  at the PostGIS driver they have developed to see how the byte array type thing 
  that Abe mentioned is done.  There's is a native driver so only piggy 
  backs on the Npgsql PostgreSQL .NET driver.  I have a quick example on my 
  site on how to use it.  Although it might have changed since I wrote 
  it</FONT></DIV>
  <DIV dir=ltr><A 
  href="http://www.bostongis.com/?content_name=postgis_sharpmap_tut01">http://www.bostongis.com/?content_name=postgis_sharpmap_tut01</A></DIV>
  <DIV dir=ltr><FONT face=Arial size=2></FONT> </DIV>
  <DIV dir=ltr><FONT face=Arial size=2></FONT> </DIV>
  <DIV dir=ltr><FONT face=Arial size=2>2) Using Mapserver Mapscript - you 
  can play with layers directly from Vb.NET or C#.  Paolo has a nice 
  tutorial on how this is done.    </FONT></DIV>
  <DIV dir=ltr><A 
  href="http://www.paolocorti.net/public/wordpress/index.php/2006/09/20/mapserver-tutorial-for-c-mapscript-asp-net/">http://www.paolocorti.net/public/wordpress/index.php/2006/09/20/mapserver-tutorial-for-c-mapscript-asp-net/</A></DIV>
  <DIV dir=ltr><FONT color=#0000ff size=2></FONT> </DIV>
  <DIV dir=ltr>3)</DIV>
  <DIV dir=ltr>Note Paolo also has some nice tutorials on using 
  ZigGIS.  ZigGIS is strictly an ArcGIS driver so you can only use it in 
  conjunction with ArcGIS.</DIV>
  <DIV dir=ltr><A 
  href="http://www.paolocorti.net/public/wordpress/index.php/2007/02/14/installing-ziggis-11-for-connecting-arcmap-to-postgis-layers/">http://www.paolocorti.net/public/wordpress/index.php/2007/02/14/installing-ziggis-11-for-connecting-arcmap-to-postgis-layers/</A></DIV>
  <DIV dir=ltr><FONT face=Arial size=2></FONT> </DIV>
  <DIV dir=ltr><FONT face=Arial size=2></FONT> </DIV>
  <DIV dir=ltr><FONT face=Arial size=2>4)  Mapserver CGI where I have 
  Mapserver query PostGIS and provide a WMS, WFS interface and then query the 
  WMS, WFS interface using  OpenLayers which I then overlay with data from 
  Google Maps, Virtual Earth etc.  OpenLayers is a javascript api but has a 
  number of interfaces for various Map services.  I personally think its 
  pretty neat.  Unfortunately I don't have any really good tutorials on 
  this - I was going to write some up on the new Openlayers 2.4 tutorial (which 
  I think supports updating data via WFS-T interfaces, a KML driver, a GML 
  driver)  and setting up Mapserver as a WFS, WMS service.  But sadly 
  I've been swamped so haven't had a chance to write these down.  Long on 
  ideas - short on time.</FONT></DIV>
  <DIV dir=ltr><FONT face=Arial size=2></FONT> </DIV>
  <DIV dir=ltr><FONT face=Arial size=2>Here is just a general OpenLayers 
  tutorial</FONT></DIV>
  <DIV dir=ltr><A 
  href="http://www.bostongis.com/?content_name=openlayers_tut_01">http://www.bostongis.com/?content_name=openlayers_tut_01</A></DIV>
  <DIV dir=ltr><FONT color=#0000ff size=2></FONT> </DIV>
  <DIV dir=ltr><A 
  href="http://www.openlayers.org">http://www.openlayers.org</A>  the 
  download file has some handy examples as well.</DIV>
  <DIV dir=ltr><FONT color=#0000ff size=2></FONT> </DIV>
  <DIV dir=ltr>5) You can publish PostGIS data with Geoserver (along with other 
  datasources by the way) as well to provide a WMS, WFS, 
  WFS-T interface and then query or update data with that with 
  anything that supports those interfaces.  I haven't done that, but I know 
  MassGIS publishes their ArcSDE data using Geoserver and if you want to update 
  data via WFS-T may be something to take a look at. GeoServer I think uses java 
  servlets so may not be an option for you if you are a strictly ..NET/Windows 
  shop.</DIV>
  <DIV dir=ltr><A 
  href="http://www.geoserver.org">http://www.geoserver.org</A></DIV>
  <DIV dir=ltr><FONT face=Arial size=2></FONT> </DIV>
  <DIV dir=ltr><FONT face=Arial size=2></FONT> </DIV>
  <DIV dir=ltr><FONT face=Arial size=2>6) Then PostGIS has functions such as 
  AsGML, AsKML, AsSVG which you can use to render these kind of formats that can 
  then be used in such things as GoogleEarth or other interfaces that support 
  these.  I was going to write up some examples on this too in how to use 
  this in .NET and PHP but - yah time is non-existent at the 
  moment.</FONT></DIV>
  <DIV dir=ltr><FONT face=Arial size=2></FONT> </DIV>
  <DIV dir=ltr><FONT face=Arial size=2>Hope that helps,</FONT></DIV>
  <DIV dir=ltr><FONT face=Arial size=2>Regina</FONT></DIV>
  <DIV dir=ltr><FONT face=Arial size=2></FONT> </DIV>
  <DIV dir=ltr><FONT face=Arial size=2></FONT> </DIV></DIV>
  <DIV dir=ltr><BR>
  <HR tabIndex=-1>
  <FONT face=Tahoma size=2><B>From:</B> 
  postgis-users-bounces@postgis.refractions.net on behalf of Abe 
  Gillespie<BR><B>Sent:</B> Wed 4/25/2007 6:52 PM<BR><B>To:</B> PostGIS Users 
  Discussion<BR><B>Subject:</B> Re: [postgis-users] PostGIS and 
  ADO.NET<BR></FONT><BR></DIV>
  <DIV>
  <P><FONT size=2>Hello Jeff,<BR><BR>There is no *direct* support per se (at 
  least none that I know of).<BR>But you can use Npgsql as the ADO.NET data 
  access driver and retrieve<BR>the shape data as byte arrays.  To get 
  instantiated shape objects<BR>you'll then have to feed the byte array into 
  libraries such as<BR>NetTopolgySuite (<A 
  href="http://nts.sourceforge.net/">http://nts.sourceforge.net/</A>), 
  SharpMap<BR>(<A 
  href="http://www.codeplex.com/SharpMap/">http://www.codeplex.com/SharpMap/</A>), 
  or consume the byte arrays<BR>directly in your code as is done in 
  zigGIS<BR>(<A 
  href="http://code.google.com/p/ziggis/">http://code.google.com/p/ziggis/</A>).<BR><BR>You'll 
  have to write your SQL spatial queries by hand.  But I suspect<BR>you'll 
  want to do this anyway.<BR><BR>Good luck!<BR><BR>--<BR>Abe Gillespie, 
  abe@digital-pulp.com<BR>Programmer for hire - GIS, Business Apps, Website 
  Apps<BR><A 
  href="http://code.google.com/p/ziggis/">http://code.google.com/p/ziggis/</A><BR><BR>On 
  4/25/07, Jeff Dege <jdege@korterra.com> wrote:<BR>> I've done some 
  web browsing, trying to find current information on how<BR>> well PostGIS 
  integrates with ADO.NET, and while I've found a number of<BR>> discussions, 
  none really seemed to answer.<BR>><BR>> Are there current ADO.NET 2.0 
  drivers for PostGIS?  Are there current<BR>> drivers for 
  PostSQL?  If only the latter exist, how does that limit what<BR>> I 
  can do with PostGIS?<BR>><BR>> 
  _______________________________________________<BR>> postgis-users mailing 
  list<BR>> postgis-users@postgis.refractions.net<BR>> <A 
  href="http://postgis.refractions.net/mailman/listinfo/postgis-users">http://postgis.refractions.net/mailman/listinfo/postgis-users</A><BR>><BR>_______________________________________________<BR>postgis-users 
  mailing list<BR>postgis-users@postgis.refractions.net<BR><A 
  href="http://postgis.refractions.net/mailman/listinfo/postgis-users">http://postgis.refractions.net/mailman/listinfo/postgis-users</A><BR></FONT></P></DIV>
  <P>
  <HR SIZE=1>

  <P></P>
  <P><STRONG>The substance of this message, including any attachments, may be 
  confidential, legally privileged and/or exempt from disclosure pursuant to 
  Massachusetts law. It is intended solely for the addressee. If you received 
  this in error, please contact the sender and delete the material from any 
  computer. </STRONG></P></BLOCKQUOTE></BODY></HTML>

<HTML><BODY><P><hr size=1></P>
<P><STRONG>
The substance of this message, including any attachments, may be confidential, legally privileged and/or exempt from disclosure pursuant to Massachusetts law. It is intended solely for the addressee. If you received this in error, please contact the sender and delete the material from any computer.
</STRONG></P></BODY></HTML>