Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#328 closed defect (fixed)

Query: Polygon query doesn't work against SQL Server Spatial Provider

Reported by: jennyhe Owned by: madair
Priority: P2 Milestone: Future
Component: Widgets Version: 1.1.1
Severity: Major Keywords:
Cc: christine.bao@…, Chris.Claydon@… Browser: All
External ID: 1277852 Operating System: All
state: New

Description

Report from Autodesk QA Steps:

  1. Load the package.
  2. Re-connect SQL Server Spatial

Service: acrdmapdb3 User/Pwd: sa/sql2008

  1. Do one Polygon Query.

Results: No matched result listed. Please refer to the attached png file.

Expected results: All points should be returned in result list.

Attachments (2)

1277730.mgp (170.9 KB ) - added by jennyhe 15 years ago.
CreatePolygon.patch (837 bytes ) - added by christinebao 15 years ago.

Download all attachments as: .zip

Change History (8)

by jennyhe, 15 years ago

Attachment: 1277730.mgp added

comment:1 by christinebao, 15 years ago

The problem of this defect is: Some providers such as SQL Server Spatial, ODBC etc requires the polygon's start point must be the same as end point when executing spatial query. When this defect happens, there is an exception:

An exception occurred in FDO component.
RDBMS: [Microsoft][ODBC SQL Server Driver][SQL Server]A .NET Framework error occurred during execution of user-defined routine or aggregate "geometry": 
System.FormatException: 24306: The Polygon input is not valid because the start and end points of the ring are not the same. Each ring of a polygon must have the same start and end points.
System.FormatException: 
   at Microsoft.SqlServer.Types.Validator.Execute(Transition transition)
   at Microsoft.SqlServer.Types.Validator.EndFigure()


Because the spatial query fail, there is no result output.

Polygon query has this defect because the input geometry text (for example click 3 points) is as following:

3,
9.0032342063902,16.787237218165,
7.6902698429583,7.2213539988755,
19.319382776212,9.472150050473


The start point is different from the end point.

Rectangle query doesn't have this defect because the input geometry text (for example) is:

5,
6.189739141893298,6.846221323609199,
17.631285737514,6.846221323609199,
17.631285737514,14.724007504201001,
6.189739141893298,14.724007504201001,
6.189739141893298,6.846221323609199


As you can see, the start point is the same as end point.

To fix this defect, the function CreatePolygonFromGeomText($geomText) should be enhanced:
if the first point is not the same as last one, create another one which is the same as first one and append to the coordinate collection.

comment:2 by christinebao, 15 years ago

Some providers don't have this requirement, such as SDF. Test on SDF and polygon query also works.

by christinebao, 15 years ago

Attachment: CreatePolygon.patch added

comment:3 by christinebao, 15 years ago

Attach patch http://trac.osgeo.org/fusion/attachment/ticket/328/CreatePolygon.patch for fixing this defect. Please review.

comment:4 by christinebao, 15 years ago

Cc: Chris.Claydon@… added

Hi Chris, would you please review this patch? This defect is nominated for Beta 1, so it's appreciated if you can finish it in this week. Thank you!

comment:5 by christinebao, 15 years ago

Resolution: fixed
Status: newclosed

This patch is tested against SQL Server Spatial, ODBC, SDF, SHP providers on Query widget, and it works.

Commit the patch for fixing.

comment:6 by chrisclaydon, 15 years ago

Patch reviewed - looks good.

Note: See TracTickets for help on using tickets.