[mapserver-users] ODBC OGR MS SQL CONNECTION

Frank Warmerdam warmerdam at pobox.com
Tue Mar 30 11:38:08 PDT 2010


ibrahimsaricicek wrote:
> This doesn't and syas; msDrawMap(): Image handling error. Failed to draw
> layer named 'Araclar'. msOGRFileOpen(): OGR error. Open failed for OGR
> connection in layer `Araclar'. Parse error at EOF, not all elements have
> been closed, starting with SrcSQL 
> 
> CONNECTIONTYPE OGR
>   CONNECTION "
>   <OGRVRTDataSource>
>     <OGRVRTLayer name='Araclar'>
>         <SrcDataSource>ODBC:webuser/webuser at MsSql</SrcDataSource>
>         <SrcSQL>SELECT MOBILEUNIT.MUID, MOBILEUNIT.PLATE,
> MUGPSDATALOG.LONGITUDE, MUGPSDATALOG.LATITUDE FROM MOBILEUNIT INNER JOIN
> MUGPSDATALOG ON MOBILEUNIT.MUID=MUGPSDATALOG.MUID WHERE
> MUGPSDATALOG.EVENTLOGID IN(SELECT MAX(EVENTLOGID) FROM MUFLEET INNER JOIN
> MUGROUP ON MUFLEET.FLEETID = MUGROUP.FLEETID INNER JOIN MOBILEUNIT ON
> MUGROUP.GROUPID = MOBILEUNIT.GROUPID INNER JOIN MUGPSDATALOG ON
> MOBILEUNIT.MUID=MUGPSDATALOG.MUID where MUFLEET.FLEETID=37144 group by
> MOBILEUNIT.MUID) ORDER BY MOBILEUNIT.PLATE</SrcSQL>
>         <GeometryType>wkbPoint</GeometryType>
>         <GeometryField encoding='PointFromColumns' x='LONGITUDE'
> y='LATITUDE'></GeometryField>
>     </OGRVRTLayer>
> </OGRVRTDataSource>"
> 
> But why?

Ibrahim,

I was unable to reproduce the problem parsing this XML VRT.  I don't
know what is going wrong.  I had expected to find a "<" sign in the
sql that was not escaped properly as < but I see none.

> And why ogr connection is too slow? Is there a way for speeding-up?

You will likely want to list the tables to be scanned on accessing
the database in the connection string or else all are scanned for
the schema - at great expense.  Also, be aware that SrcSQL results
are slow if used in random access mode - such as is done my MapServer's
query mechanisms.  That should not be a problem for simple drawing though.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent




More information about the MapServer-users mailing list