[gdal-dev] Re: [mapserver-users] OGRinfo works, but a MapServer test mode=map DOES NOT

Eduardo Kanegae eduardo.kanegae at gmail.com
Thu May 26 14:02:11 EDT 2011


Thanks Brent and Jeff for your suggestions.

My old scenario was:
- the system was running fine on Windows 2003 Server 64bits with SQL
2008+ MsSqlSpatial Lib using MapServer with ODBC

But now, the server was upgraded to Windows Server 2008 64bits with SQL 2008R2.

And the only way I finally found to put it to work was:
- use MSSQL OGR Driver but DOT NOT use geometry field type of SQL 2008
( absolutely slow! )
- instead of 2008 field I translate 2005 geom field ( MsSqlSpatial
lib) to WKT using:

... ST.AsText(v.geom_2005) AS geom_2008

And now it´s working!

Thanks for helping.

best


-- 
Eduardo Patto Kanegae


2011/5/26 Brent Fraser <bfraser at geoanalytic.com>:
> Eduardo,
>
>  What happens when you use ogrinfo to access it via ODBC:
>
> ogrinfo ODBC:my_user/my_passwd at my_dsn
>
> or if you put the connection in a vrt file and use ogrinfo on it?
>
> Best Regards,
> Brent Fraser
>
>
> On 5/26/2011 4:26 AM, Eduardo Kanegae wrote:
>>
>> Hi all,
>>
>> I´m running Windows Server 2008 R2 Enterprise SP1 64bits using MS4W
>> 3.0.1 with MapServer CGI 5.6.6 grabed from MapTools.org
>> My spatial data is on SQL Server 2008 + MsSqlSpatial 0.1.1 Lib and
>> I´ve set an ODBC DSN connection using SQL Server Native Driver 10
>> ( using Control Panel ->  ODBC Admin ->  System DSN and also
>> C:\Windows\SysWOW64\odbcad32.exe tool )
>>
>> When I run ogrinfo using:
>> $ ogrinfo -so
>> "MSSQL:dsn=my_dsn;server=(local);database=my_database;tables=dbo.my_table;uid=my_user;pwd=my_passwd"
>> my_table
>>
>> it works and dumps info like:
>> ...
>> INFO: Open of
>> `MSSQL:dsn=nucoffee;server=(local);database=nucoffee;tables=dbo.fazendas2;uid=db_nucoffee;pwd=@&NuCoFfEe&@'
>>       using driver `MSSQLSpatial' successful.
>> ... and so on!
>>
>> BUT, when trying a MapServer CGI mode map request like:
>>
>> http://my_server/cgi-bin/mapserv.exe?map=e:/my_mapfile.map&mode=map&layers=all&map_size=800+600
>> I only got the error:
>>
>> msDrawMap(): Image handling error. Failed to draw layer named
>> 'pol_my_layer'. msOGRFileOpen(): OGR error. Open failed for OGR
>> connection in layer `pol_my_layer'. Unable to initialize ODBC
>> connection to DSN for my_user/my_passwd at my_dsn, [Microsoft][ODBC
>> Driver Manager] Data source name not found and no default driver
>> specified
>>
>> Can anybody give me a clue on that?
>>
>> My LAYER mapfile part is defined as :
>>
>> **********************
>> LAYER
>>                NAME                    "pol_my_layer"
>>                TYPE                    POLYGON
>>                CONNECTIONTYPE OGR
>>                CONNECTION "<OGRVRTDataSource>
>>     <OGRVRTLayer name='pol_my_layer'>
>>
>>  <SrcDataSource>ODBC:my_user/my_passwd at my_dsn</SrcDataSource>
>>                <SrcLayer>dbo.vw_pol_my_spatial_view</SrcLayer>
>>                <LayerSRS>WGS84</LayerSRS>
>>                <GeometryType>wkbUnknown</GeometryType>
>>                <GeometryField encoding='WKB' field='geom_2005'/>
>>     </OGRVRTLayer>
>> </OGRVRTDataSource>"
>>                DATA "pol_my_layer"
>>                FILTER "329"
>>                FILTERITEM "farm_id"
>>                PROCESSING "CLOSE_CONNECTION=DEFER"
>>        END
>>        ...
>> END
>> **********************
>>
>> best regards,
>>
>> --
>> Eduardo Patto Kanegae
>> _______________________________________________
>> mapserver-users mailing list
>> mapserver-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>>
>
>


More information about the gdal-dev mailing list