泰拉瑞亚大橙子12:SQL Server 2008 Spatial, PostgreSQL/PostGIS 1...

来源:百度文库 编辑:偶看新闻 时间:2024/04/29 00:02:10

SQL Server 2008 Spatial, PostgreSQL/PostGIS 1.3-1.4, MySQL 5-6 三种支持空间数据系统比较

 

General Overview

FeatureSQL Server 2008 (RC0)MySQL 5.1/6PostgreSQL 8.3/PostGIS 1.3/1.4OSWindows XP, Windows Vista, Windows 2003, Windows 2008Windows XP, Windows Vista, (haven't tested on 2008), Linux, Unix, MacWindows 2000+ (including Vista and 2003, haven't tested on 2008), Linux, Unix, MacLicensingCommercial - Closed Source, Various levels of features based on version, Express version has full spatial support but limitation on database size and only use one processor.Commercial Open Source (COSS), some parts GPL. Here is an interesting blog entry on the subject MySQL free software but not Open Source. The comments are actually much more informative than the article itself.FLOSS (PostgreSQL is BSD, PostGIS is GPL Open Source - you can use for commercial apps but if you make changes to the core libraries of PostGIS, you need to give that back to the community)Free GIS Data Loadersshp dataloader for SQL Server 2008 developed by Morten Nielsen (doesn't yet work with RC0)OGR2OGR, shp2mysql.pl scriptincluded shp2pgsql, OGR2OGR, QuantumGIS SPIT, SHP loader for PostGIS also developed by Morten using SharpMap.NET various othersCommercial GIS Data LoadersManifold, Safe FME Objects, ESRI ArcGIS 9.3 (in a later service pack)Safe FME ObjectsManifold, FME Objects, ESRI ArcGIS 9.3Application drivers available specifically for spatial component? Not yet - SharpMap.NET eventually and probably built into new ADO.NET 3.5+GDAL C++, SharpMap via OGR, AutoCAD FDOSharpMap.Net, JDBC postgis.jar included with postgis, JTS etc. tons for Java, GDAL C++, AutoCad FDO beta supportFree Object/Relational MappingNHibernateSpatial (this is a .NET object relational spatial mapper) - beta supportHibernate Spatial - this is a java object relational mapperNHibernateSpatial and HibernateSpatialFree Desktop Viewers and EditorsWill be built into SQL Manager, but not available in RC0 and only useful for viewingGvSigOpenJump, QuantumGIS, GvSig, uDigCommercial Desktop Viewers and EditorsESRI ArcGIS 9.3 Server SDE later service pack, Manifold, FMEFMEESRI ArcGIS 9.3 Server, ZigGIS for desktop, Manifold, FMEWeb Mapping ToolKits - it must be said things like OpenLayers and various other scripting frameworks that can accept GML will work with any of these databases and your favorite web scripting languageManifold, MapDotNet, ArcGIS 9.3 (in later service pack), UMN MapServer see, MapGuide Open Source (using beta FDO driver)UMN Mapserver, GeoServer, MapGuide Open SourceManifold, MapDotNet, ArcGIS 9.3, UMN Mapserver, GeoServer, FeatureServer, MapGuide Open Source (using beta FDO driver)Spatial FunctionsBoth OGC SFSQL MM and Geodetic custom (over 70 functions)OGC mostly only MBR (bounding box functions) few true spatial relation functions, 2D onlyOver 300 functions and operators, no geodetic support except for point-2-point non-indexed distance functions, custom PostGIS for 2D and some 3D, some MM support of circular strings and compound curvesSpatial Indexes (from reports Oracle also uses some sort of R-Tree indexing scheme and can use quadtree, IBM DB2 uses quadtree, Spherical Voronoi Tessalation, IBM Informix uses R-Tree. Note R-Tree indexes are self-tuning and do not require grid setupYes - 4 level Multi-Level grid hierarchy (BOL says its B-Tree based) with tessalation as described Isaac Kunen Multi-Level Grid requires defining an index grid for optimal performanceR-Tree quadratic splitting - indexes only exist for MyISAMGIST - a variant of R-TreeTrue Geodetic support - support for true measurement along a spherical coordinate (it must be noted Oracle and IBM provide geodetic support, although IBM Informix/DB2 have it as an additional Blade add-on in addition to standard spatial)Yes - with caveats - must use Geography type which has the following constraints, no single geometry may overlap hemispheres, intersections, some operations are undefined for two geometries in separate hemispheres. SRID must be defined in spatial ref. Orientation of polygons is important in Geography. According to BOL - ST_Distance is only supported when one of the geography instances is a point ( NOTE: Isaac Kunen says the BOL docs are wrong about ST_Distance and this restriction has been lifted) . Fewer spatial functions available for geography than geometryNoNoShared HostingManyManyMuch fewer, but ramping up. It must be noted that if you have a dedicated Linux/Windows server, and aren't afraid to be your own admin (or to get a qualified consultant such as us), then your options are much wider. List of community recommended PostGIS Hosters

Now for this section, we can't really itemize all the functions of each offering. We will just focus on the functions we consider most commonly used in spatial analysis and geoprocessing. For this section we are treating SQL Server 2008 as two products because functionality available for its planar (Geometry) is not the same as functionality available for Geography. In theory you can convert between the 2 types by using the GeomFromWKB and AsBinary functions that each type provides if they have the same SRID, but without Transform function, this is of limited use.

Please also note that these offerings have not officially come out yet. SQL Server 2008 is currently at RC0 and will be released in another 2-3 months. From accounts we have read, the functionality that is in RC0 is pretty much what you can expect in the RTM except that the RTM will have integrated spatial viewing in the SQL Management studio. MySQL just came out with 5.1 RC and will soon be out with 5.1 and won't come out with 6 for probably another year or so. In general though they haven't done much with improving their spatial support so the 5+ is just more stable than the 4.0 and 6.0 will probably have more stability and the query optimizer is improved which will indirectly help spatial queries, but not much intro of new functionality. PostGIS is currently at 1.3.3 and will be coming out with 1.3.4 very shortly. For all intensive purposes there is not much of a difference between 1.3.3 and 1.3.4 aside from bug fixes, ST_DWithin speed improvement and ST_AsGeoJSON. 1.4 will have vast speed improvements for doing cascaded aggregate unions, a bit better curve support.

For more extensive details - for MySQL check out - MySQL 5.1 Spatial Extensions, MySQL 6 Spatial Extensions, PostGIS 1.3.4, PostGIS 1.4 SVN in progress, SQL Server 2008 Web docs, SQL Server 2008 Books Online download. For SQL Server 2008 Books OnLine, if you are running a Windows Installer service lower than 4.5, then you'll get an error "The installation package can not be installed by Windows Installer Service. You must install a windows service pack that contains a newer version of the windows installer service. ". If you get such an error then - download and install the Windows Installer service 4.5 from http://www.microsoft.com/downloads/details.aspx?FamilyID=5a58b56f-60b6-4412-95b9-54d056d6f9f4&DisplayLang=en

Spatial Functionality

FeatureSQL Server 2008 (RC0) GeometrySQL Server 2008 (RC0) GeographyMySQL 5.1/6PostgreSQL 8.3/PostGIS 1.3/1.4Supported Geometry TypesPolygon, Point, LineString, MultiLineString, MultiPoint, MultiPolygon, GeometryCollection 2D support also storage for 3D and 4D (M,Z)Polygon, Point, LineString, MultiLineString, MultiPoint, MultiPolygon, GeometryCollection, 2D, ability to store 3D, 4D (M and Z)2D, can store 3D 4D(e.g. M and Z) but no functions do anything with those) - Polygon, Point, LineString, MultiPoint, MultiPolygon,MultiLineString, GeometryCollection2D, some 3D, 4D (support for storing Z,M but most spatial functions ignore the higher dimensions) and some curve support - Polygon, Point, LineString, MultiPoint, MultiPolygon, MultiLineString, GeometryCollection, CircularString, CompoundCurve, CurvePolygon, MultiCurve, MultiSurfaceTransform - ability to transform from one spatial ref to anotherNo - need 3rd-party tools, Geometry can use any SRID between 0 and 999999No, but less need for transform since spherical coordinates that cover the globe can be used. SRID must be defined in sys.spatial_reference_systemsNoST_Transform - Yes for 2D and 3D, but not for Circular Curve TypesGeometry Output functions - these are important particular for web-development when using the various javascript, flash apisSTAsBinary(), STAsText(), AsGML(), AsTextZM(), will have a builder api in the RTM for extending to support more output formatsSame as the geometry onesAsBinary(), AsText()ST_AsBinary(), ST_AsText(), ST_AsSVG(), ST_AsGML(), ST_AsKML(), ST_AsGeoJson() -- new in 1.3.4, ST_AsEWKT(), ST_AsHexEWKB()Geometry Input functionsSTGeomFromText(),STGeomFromWKB(), GeomFromGML()Same as GeometryGeomFromText(), GeomFromWKB()ST_GeomFromText(), ST_GeomFromWKB()Intersects and IntersectionSTIntersects(), STIntersection() (spatial ref of both geoms must be the same)Same as geometry except an intersection resulting in a polygon that overlaps 2 hemispheres will return nullMBRIntersects()* bounding box only (spatial refs of both geoms must be the same), they do not implement Intersection yetST_Intersects(), ST_Intersection() (spatial ref must be the same)Other Non-Agg key relationship and relation outputsSTContains(), STDifference(), STDisjoint(), STEquals(), STOverlaps(), STRelate(), STSymDifference(), STTouches(), STWithin()STDisjoint()MBRContains(), MBREqual(), MBROverlaps, MBRTouches(), MBRWithin(), bounding box only (spatial refs of both geoms must be the same) (these are aliased in 6.0 to names Contains(), Overlaps(), Equals()... but do the same as MBR)ST_Contains(), ST_Disjoint(), ST_Difference(), ST_Equals(), ST_Overlaps(), ST_Relate(), ST_SymDifference(), ST_Touches(), ST_Within() (spatial ref must be the same)Accessors and EditorsBufferWithTolerance() (this is similar to PostGIS variant of Buffer that takes 3 args (defaulted to 8 number of segs to use to approximate a quarter circle), MakeValid(), Reduce() - similar to PostGIS ST_Simplify(), STBoundary(), STBuffer(),STCentroid(), STConvexHull(), STDimension(), STEndPoint(), STExteriorRing(), STGeometryN(), STGeometryType(), STInteriorRingN(), STIsClosed(), STIsEmpty(), STIsSimple(), STNumGeometries(), STNumPoints() (only applies to LINESTRINGS), STPointN((), STStartPoint(), STSRID(), STUnion()NumRings(), RingN(), STArea(), STBuffer(), STDimension(), STEndpoint(),STGeometryN(), STGeometryType(), STIsClosed(), STIsEmpty(), STLength(), STNumGeometries(), STNumPoints(), STPointN(), STSrid(), STStartPoint(), STUnion()Centroid(), Dimension(), EndPoint(), Envelope(), ExteriorRing(), GeomtryN(), GeometryType(), InteriorRingN(), IsClosed(), IsRing(), NumPoints(), PointN(), SRID(), StartPoint()ST_Affine(), ST_Boundary(), ST_Buffer() (2 variants similar to STBuffer() and BufferWithTolerance()), ST_Centroid(), ST_ConvexHull(), ST_Dimension(), ST_EndPoint(), ST_ExteriorRing(), ST_GeometryN(), ST_GeometryType(), ST_InteriorRingN(), ST_IsClosed(), ST_IsEmpty(),ST_IsRing(), ST_ISSimple(), ST_NumGeometries(),ST_NumPoints() (only applies to linestrings), ST_NPoints() - returns num vertexes regardless of geometry type, ST_PointN(), ST_Simplify(), ST_StartPoint(), ST_SRID(),ST_Translate(), ST_Union(), various MakeLine,MakePolygon, buildarea etc.MeasurementSTArea(), STLength(), STDistance() (measurements in unit of spatial ref)Same as geometry - except measurements can be in meters, sq meters, or units of spatial refArea(), GLength(), Distance()ST_Area(), ST_Length(), ST_Distance(), ST_Distance_Spheroid(), ST_Length_Spheriod (non-sphere, non-spheriod functions units are in spatial ref, sphere and spheroid are in meters but only work for point geometries) and equivalents for 3D geometries.Linear Referencing - things like returning fractions of lines, approximating point location along a line based on num addressnone built in, but can roll your own with CLR. UPDATE Isaac Knunen has some linear referencing functions already built in the new CodePlex SQL Server Spatial Tools project.none built in - check out new SQL Server Spatial tools code plex projectnoneST_Line_Interpolate_point(), ST_Line_Substring(), ST_line_locate_point(), ST_locate_along_measure(), ST_locate_between_measures()Spatial Aggregates (functions like SUM but for spatial)Apparently none in this release so have to roll your own with CLR. There are numerous examples of this on the web.
UPDATE SQL Server 2008 Spatial Tools contains aggregate functions for Union and Envelop similar to PostGIS ST_Union and ST_Extent functionsnonenoneST_Extent(), ST_Collect(), ST_Union(), ST_Accum(), ST_MakeLine(), ST_Polygonize()