[postgis-users] PostGIS and ADO.NET
Jeff Dege
jdege at korterra.com
Thu Apr 26 08:23:44 PDT 2007
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.
>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.
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.
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.
Can we do this through WFS? If so, we might not need to access the
geometry from the web server code-behinds at all.
Eventually, though, we're almost certain to run into a problem where
we'll want to have server-side code manipulating geometry.
I'll look at SharpMap.
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.
________________________________
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Obe,
Regina
Sent: Thursday, April 26, 2007 3:05 AM
To: PostGIS Users Discussion
Subject: RE: [postgis-users] PostGIS and ADO.NET
Jeff,
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.
SharpMap and ZigGIS do that already for you I think so you can
just focus on writing the SQL statements. Not sure about
NetTopologySuite.
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.
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
http://www.bostongis.com/?content_name=postgis_sharpmap_tut01
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.
http://www.paolocorti.net/public/wordpress/index.php/2006/09/20/mapserve
r-tutorial-for-c-mapscript-asp-net/
3)
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.
http://www.paolocorti.net/public/wordpress/index.php/2007/02/14/installi
ng-ziggis-11-for-connecting-arcmap-to-postgis-layers/
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.
Here is just a general OpenLayers tutorial
http://www.bostongis.com/?content_name=openlayers_tut_01
http://www.openlayers.org the download file has some handy
examples as well.
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.
http://www.geoserver.org
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.
Hope that helps,
Regina
________________________________
From: postgis-users-bounces at postgis.refractions.net on behalf of
Abe Gillespie
Sent: Wed 4/25/2007 6:52 PM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] PostGIS and ADO.NET
Hello Jeff,
There is no *direct* support per se (at least none that I know
of).
But you can use Npgsql as the ADO.NET data access driver and
retrieve
the shape data as byte arrays. To get instantiated shape
objects
you'll then have to feed the byte array into libraries such as
NetTopolgySuite (http://nts.sourceforge.net/), SharpMap
(http://www.codeplex.com/SharpMap/), or consume the byte arrays
directly in your code as is done in zigGIS
(http://code.google.com/p/ziggis/).
You'll have to write your SQL spatial queries by hand. But I
suspect
you'll want to do this anyway.
Good luck!
--
Abe Gillespie, abe at digital-pulp.com
Programmer for hire - GIS, Business Apps, Website Apps
http://code.google.com/p/ziggis/
On 4/25/07, Jeff Dege <jdege at korterra.com> wrote:
> I've done some web browsing, trying to find current
information on how
> well PostGIS integrates with ADO.NET, and while I've found a
number of
> discussions, none really seemed to answer.
>
> Are there current ADO.NET 2.0 drivers for PostGIS? Are there
current
> drivers for PostSQL? If only the latter exist, how does that
limit what
> I can do with PostGIS?
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
________________________________
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20070426/77b5e717/attachment.html>
More information about the postgis-users
mailing list