Re: [mapserver-users] Problem using getShape with MsSql2008 (Mapscript C#)

2009-09-15 Thread Tamas Szekeres
Paul,

To avoid this problem you might want to set either the buffer parameter of
queryByPoint or layerObj.tolerance to a positive value to avoid passing a
rectangle with no extent to the SQL data source.


Best regards,

Tamas



2009/9/15 Paul james 

> Tamas,
>
> The last problem with getShape is solved and working fine
> But now I got other possible bug using MsSql2008/C# ...
>
> Code :
>  MapObj.queryByPoint(_oGeo, mapscript.MS_MULTIPLE, -1)
>
> Thas is working fine with Postgis...
>
> But wth MsSql2008, got the following error :
>  (using queryByRect all works fine)
>
> msMSSQL2008LayerGetShape(): Query error. Error executing MSSQL2008 SQL
> statement: SELECT convert(varchar(max), oid),convert(varchar(max),
> anoreferencia),convert(varchar(max), uf),convert(varchar(max),
> rodovia),convert(varchar(max), codigopnv),convert(varchar(max),
> localiniciofim),convert(varchar(max), inicio),convert(varchar(max),
> fim),convert(varchar(max), extensao),convert(varchar(max),
> superficie),convert(varchar(max), listacoincidente),convert(varchar(max),
> estadualcoincidente),convert(varchar(max),
> superficieestadualcoincidente),convert(varchar(max),
> mp_082),convert(varchar(max),
> concessaoconvenio),the_geom.STAsBinary(),convert(varchar(20), oid) from
> viwgeo_test WHERE
> the_geom.STIntersects(Geometry::STGeomFromText('POLYGON((-74.6741893243784
> 2.46256865079364,-74.6741893243784 2.46256865079364,-74.6741893243784
> 2.46256865079364,-74.6741893243784 2.46256865079364,-74.6741893243784
> 2.46256865079364))',0)) = 1
> -[Microsoft][ODBC SQL Server Driver][SQL Server]:
> System.FormatException: 24305: The Polygon input is not valid because the
> ring does not have enough distinct points. Each ring of a polygon must
> contain at least three distinct points.
> System.FormatException:
>at Microsoft.SqlServer.Types.Validator.Execute(Transition transition)
>at Microsoft.SqlServer.Types.Validator.EndFigure()
>at Microsoft.SqlServer.Types.ForwardingGeoDataSink.EndFigure()
>at Microsoft.SqlServer.Types.OpenGisWktReader.ParseLineStringText()
>at Microsoft.SqlServer.Types.OpenGisWktReader.ParsePolygonText()
>at
> Microsoft.SqlServer.Types.OpenGisWktReader.ParseTaggedText(OpenGisType type)
>at Microsoft.SqlServer.Types.OpenGisWktReader.Read(OpenGisType type,
> Int32 srid)
>at Microsoft.SqlServer.Types.SqlGeometry.GeometryFromText(OpenGisType
> type, SqlChars text, Int32 srid)
>at Microsoft.SqlServer.Types.SqlGeometry.STGeom
>
>
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Problem using getShape with MsSql2008 (Mapscript C#)

2009-09-15 Thread Paul james
Tamas,

The last problem with getShape is solved and working fine
But now I got other possible bug using MsSql2008/C# ...

Code :
 MapObj.queryByPoint(_oGeo, mapscript.MS_MULTIPLE, -1)

Thas is working fine with Postgis...

But wth MsSql2008, got the following error :
 (using queryByRect all works fine)

msMSSQL2008LayerGetShape(): Query error. Error executing MSSQL2008 SQL
statement: SELECT convert(varchar(max), oid),convert(varchar(max),
anoreferencia),convert(varchar(max), uf),convert(varchar(max),
rodovia),convert(varchar(max), codigopnv),convert(varchar(max),
localiniciofim),convert(varchar(max), inicio),convert(varchar(max),
fim),convert(varchar(max), extensao),convert(varchar(max),
superficie),convert(varchar(max), listacoincidente),convert(varchar(max),
estadualcoincidente),convert(varchar(max),
superficieestadualcoincidente),convert(varchar(max),
mp_082),convert(varchar(max),
concessaoconvenio),the_geom.STAsBinary(),convert(varchar(20), oid) from
viwgeo_test WHERE
the_geom.STIntersects(Geometry::STGeomFromText('POLYGON((-74.6741893243784
2.46256865079364,-74.6741893243784 2.46256865079364,-74.6741893243784
2.46256865079364,-74.6741893243784 2.46256865079364,-74.6741893243784
2.46256865079364))',0)) = 1
-[Microsoft][ODBC SQL Server Driver][SQL Server]:
System.FormatException: 24305: The Polygon input is not valid because the
ring does not have enough distinct points. Each ring of a polygon must
contain at least three distinct points.
System.FormatException:
   at Microsoft.SqlServer.Types.Validator.Execute(Transition transition)
   at Microsoft.SqlServer.Types.Validator.EndFigure()
   at Microsoft.SqlServer.Types.ForwardingGeoDataSink.EndFigure()
   at Microsoft.SqlServer.Types.OpenGisWktReader.ParseLineStringText()
   at Microsoft.SqlServer.Types.OpenGisWktReader.ParsePolygonText()
   at Microsoft.SqlServer.Types.OpenGisWktReader.ParseTaggedText(OpenGisType
type)
   at Microsoft.SqlServer.Types.OpenGisWktReader.Read(OpenGisType type,
Int32 srid)
   at Microsoft.SqlServer.Types.SqlGeometry.GeometryFromText(OpenGisType
type, SqlChars text, Int32 srid)
   at Microsoft.SqlServer.Types.SqlGeometry.STGeom
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Problem using getShape with MsSql2008 (Mapscript C#)

2009-08-07 Thread Tamas Szekeres
Another issue coul be that the layer type is not compatible with the
geometry type, like the following combinations are invalid with this driver:

Layer type   shape geom type

line  point
polygon  point
polygon  line


I'd also be curious about the wkb of your geometry

Could you dump your related feature table  in the SQL management studio
query analyzer?

select * from [table] where [id]=10

or something like this...

Best regards,

Tamas


2009/8/7 Paul james 

> Yes But the same code with a Postgis db is ok...
> Image attached
>
> Paul
>
>
> On Fri, Aug 7, 2009 at 11:21 AM, Tamas Szekeres wrote:
>
>> This appears to be a null shape with no valid geometry. (type=3, numlines
>> = 0)
>>
>> Best regards,
>>
>> Tamas
>>
>>
>>
>> 2009/8/7 Paul james 
>>
>> The layer geometry is fine...
>>> I´m sending a shape property screenshot...
>>>
>>> Paul
>>>
>>>
>>> On Fri, Aug 7, 2009 at 5:25 AM, Tamas Szekeres wrote:
>>>
 Paul,

 There is a function (find_bounds) calculating the bounds in
 mapmssql2008.c which should provide correct results.
 Could you check whether the returned geometry is correct by dumping the
 point coordinates of each lines in mapscript?

 Best regards,

 Tamas


 2009/8/6 Paul james 

 Just an update...
> The shape values are all there... The only thing is wrong is the bounds
> (-1) ...
>
>
> On Wed, Aug 5, 2009 at 5:44 PM, Paul james  wrote:
>
>> I´ll check...
>> But the same layer/id worked fine using Postgis... So I should be a
>> bug...
>>
>> Paul
>>
>>
>> On Wed, Aug 5, 2009 at 5:38 PM, Tamas Szekeres 
>> wrote:
>>
>>> Hi,
>>>
>>> I think you should check the sql statement submitted by the driver by
>>> using the SQL Profiler. I suspect no records have been retrieved during 
>>> the
>>> fetch.
>>>
>>> Best regards,
>>>
>>> Tamas
>>>
>>>
>>> 2009/8/5 Paul james 
>>>
  Hello guys...
 That code is working fine with Postgis:

 _layer.open();
 var _shape = new shapeObj((int)_layer.type);
 _layer.getShape(_shape, 0, __id.ToInt32());

 The _shape.bounds are all -1 using MsSql2008 ...

 Any idea?

 ___
 mapserver-users mailing list
 mapserver-users@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/mapserver-users


>>>
>>
>

>>>
>>
>
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Problem using getShape with MsSql2008 (Mapscript C#)

2009-08-07 Thread Tamas Szekeres
This appears to be a null shape with no valid geometry. (type=3, numlines =
0)

Best regards,

Tamas



2009/8/7 Paul james 

> The layer geometry is fine...
> I´m sending a shape property screenshot...
>
> Paul
>
>
> On Fri, Aug 7, 2009 at 5:25 AM, Tamas Szekeres wrote:
>
>> Paul,
>>
>> There is a function (find_bounds) calculating the bounds in mapmssql2008.c
>> which should provide correct results.
>> Could you check whether the returned geometry is correct by dumping the
>> point coordinates of each lines in mapscript?
>>
>> Best regards,
>>
>> Tamas
>>
>>
>> 2009/8/6 Paul james 
>>
>> Just an update...
>>> The shape values are all there... The only thing is wrong is the bounds
>>> (-1) ...
>>>
>>>
>>> On Wed, Aug 5, 2009 at 5:44 PM, Paul james  wrote:
>>>
 I´ll check...
 But the same layer/id worked fine using Postgis... So I should be a
 bug...

 Paul


 On Wed, Aug 5, 2009 at 5:38 PM, Tamas Szekeres wrote:

> Hi,
>
> I think you should check the sql statement submitted by the driver by
> using the SQL Profiler. I suspect no records have been retrieved during 
> the
> fetch.
>
> Best regards,
>
> Tamas
>
>
> 2009/8/5 Paul james 
>
>>  Hello guys...
>> That code is working fine with Postgis:
>>
>> _layer.open();
>> var _shape = new shapeObj((int)_layer.type);
>> _layer.getShape(_shape, 0, __id.ToInt32());
>>
>> The _shape.bounds are all -1 using MsSql2008 ...
>>
>> Any idea?
>>
>> ___
>> mapserver-users mailing list
>> mapserver-users@lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>>
>>
>

>>>
>>
>
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Problem using getShape with MsSql2008 (Mapscript C#)

2009-08-07 Thread Paul james
The layer geometry is fine...
I´m sending a shape property screenshot...

Paul

On Fri, Aug 7, 2009 at 5:25 AM, Tamas Szekeres  wrote:

> Paul,
>
> There is a function (find_bounds) calculating the bounds in mapmssql2008.c
> which should provide correct results.
> Could you check whether the returned geometry is correct by dumping the
> point coordinates of each lines in mapscript?
>
> Best regards,
>
> Tamas
>
>
> 2009/8/6 Paul james 
>
> Just an update...
>> The shape values are all there... The only thing is wrong is the bounds
>> (-1) ...
>>
>>
>> On Wed, Aug 5, 2009 at 5:44 PM, Paul james  wrote:
>>
>>> I´ll check...
>>> But the same layer/id worked fine using Postgis... So I should be a
>>> bug...
>>>
>>> Paul
>>>
>>>
>>> On Wed, Aug 5, 2009 at 5:38 PM, Tamas Szekeres wrote:
>>>
 Hi,

 I think you should check the sql statement submitted by the driver by
 using the SQL Profiler. I suspect no records have been retrieved during the
 fetch.

 Best regards,

 Tamas


 2009/8/5 Paul james 

>  Hello guys...
> That code is working fine with Postgis:
>
> _layer.open();
> var _shape = new shapeObj((int)_layer.type);
> _layer.getShape(_shape, 0, __id.ToInt32());
>
> The _shape.bounds are all -1 using MsSql2008 ...
>
> Any idea?
>
> ___
> mapserver-users mailing list
> mapserver-users@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>
>

>>>
>>
>
<>___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Problem using getShape with MsSql2008 (Mapscript C#)

2009-08-07 Thread Tamas Szekeres
Paul,

There is a function (find_bounds) calculating the bounds in mapmssql2008.c
which should provide correct results.
Could you check whether the returned geometry is correct by dumping the
point coordinates of each lines in mapscript?

Best regards,

Tamas


2009/8/6 Paul james 

> Just an update...
> The shape values are all there... The only thing is wrong is the bounds
> (-1) ...
>
>
> On Wed, Aug 5, 2009 at 5:44 PM, Paul james  wrote:
>
>> I´ll check...
>> But the same layer/id worked fine using Postgis... So I should be a bug...
>>
>> Paul
>>
>>
>> On Wed, Aug 5, 2009 at 5:38 PM, Tamas Szekeres wrote:
>>
>>> Hi,
>>>
>>> I think you should check the sql statement submitted by the driver by
>>> using the SQL Profiler. I suspect no records have been retrieved during the
>>> fetch.
>>>
>>> Best regards,
>>>
>>> Tamas
>>>
>>>
>>> 2009/8/5 Paul james 
>>>
  Hello guys...
 That code is working fine with Postgis:

 _layer.open();
 var _shape = new shapeObj((int)_layer.type);
 _layer.getShape(_shape, 0, __id.ToInt32());

 The _shape.bounds are all -1 using MsSql2008 ...

 Any idea?

 ___
 mapserver-users mailing list
 mapserver-users@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/mapserver-users


>>>
>>
>
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Problem using getShape with MsSql2008 (Mapscript C#)

2009-08-06 Thread Paul james
Just an update...
The shape values are all there... The only thing is wrong is the bounds (-1)
...

On Wed, Aug 5, 2009 at 5:44 PM, Paul james  wrote:

> I´ll check...
> But the same layer/id worked fine using Postgis... So I should be a bug...
>
> Paul
>
>
> On Wed, Aug 5, 2009 at 5:38 PM, Tamas Szekeres wrote:
>
>> Hi,
>>
>> I think you should check the sql statement submitted by the driver by
>> using the SQL Profiler. I suspect no records have been retrieved during the
>> fetch.
>>
>> Best regards,
>>
>> Tamas
>>
>>
>> 2009/8/5 Paul james 
>>
>>>  Hello guys...
>>> That code is working fine with Postgis:
>>>
>>> _layer.open();
>>> var _shape = new shapeObj((int)_layer.type);
>>> _layer.getShape(_shape, 0, __id.ToInt32());
>>>
>>> The _shape.bounds are all -1 using MsSql2008 ...
>>>
>>> Any idea?
>>>
>>> ___
>>> mapserver-users mailing list
>>> mapserver-users@lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>>>
>>>
>>
>
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Problem using getShape with MsSql2008 (Mapscript C#)

2009-08-05 Thread Paul james
I´ll check...
But the same layer/id worked fine using Postgis... So I should be a bug...

Paul

On Wed, Aug 5, 2009 at 5:38 PM, Tamas Szekeres  wrote:

> Hi,
>
> I think you should check the sql statement submitted by the driver by using
> the SQL Profiler. I suspect no records have been retrieved during the fetch.
>
> Best regards,
>
> Tamas
>
>
> 2009/8/5 Paul james 
>
>> Hello guys...
>> That code is working fine with Postgis:
>>
>> _layer.open();
>> var _shape = new shapeObj((int)_layer.type);
>> _layer.getShape(_shape, 0, __id.ToInt32());
>>
>> The _shape.bounds are all -1 using MsSql2008 ...
>>
>> Any idea?
>>
>> ___
>> mapserver-users mailing list
>> mapserver-users@lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>>
>>
>
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Problem using getShape with MsSql2008 (Mapscript C#)

2009-08-05 Thread Tamas Szekeres
Hi,

I think you should check the sql statement submitted by the driver by using
the SQL Profiler. I suspect no records have been retrieved during the fetch.

Best regards,

Tamas


2009/8/5 Paul james 

> Hello guys...
> That code is working fine with Postgis:
>
> _layer.open();
> var _shape = new shapeObj((int)_layer.type);
> _layer.getShape(_shape, 0, __id.ToInt32());
>
> The _shape.bounds are all -1 using MsSql2008 ...
>
> Any idea?
>
> ___
> mapserver-users mailing list
> mapserver-users@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>
>
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] Problem using getShape with MsSql2008 (Mapscript C#)

2009-08-05 Thread Paul james
Hello guys...
That code is working fine with Postgis:

_layer.open();
var _shape = new shapeObj((int)_layer.type);
_layer.getShape(_shape, 0, __id.ToInt32());

The _shape.bounds are all -1 using MsSql2008 ...

Any idea?
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users