[ms4w-users] Problem with OGR connection for XY point layer

Frank Warmerdam warmerdam at pobox.com
Mon Feb 5 22:51:20 EST 2007


Gaston Izaguirre wrote:
> Hi all,
> 
> I'm using MS4W 1.5.5 on WinXP SP2 (mapserver 4.8.4, PHP 4.4.3, 
> php_mapscript_48.dll, GDAL to 1.3.2).
> I'm trying to connect to a SQL server 2000 through an OGR Virtual Format 
> driver to obtain X,Y coordinates plus other ancillary data from a View 
> that I defined in the database. The data base is updated constantly with 
> new coordinates, so the number of rows can change, actually there are 
> about 20 points.
> 
> The syntax of my .OVF file is:
> 
> <OGRVRTDataSource>
>    <OGRVRTLayer name="puntos">
>        
> <SrcDataSource>ODBC:mi_usuario/mi_password at mi_DSN,mi_vista_de_la_bd</SrcDataSource> 
> 
>        <SrcLayer>mi_vista_de_la_bd</SrcLayer>
>        <!--  <FID>Poul_id</FID>  -->
>        <GeometryType>wkbPoint</GeometryType>
>        <LayerSRS>WGS84</LayerSRS>
>        <!--  <LayerSRS>EPSG:4326</LayerSRS>  -->
>        <GeometryField encoding="PointFromColumns" x="Poul_longitud" 
> y="Poul_latitud"/>
>    </OGRVRTLayer>
> </OGRVRTDataSource>
...
> As you can see, the connection retrieves the 20 points, but there is a 
> problem with the X/Y (lat/lon) values: they are rounded to the integer 
> part, in spite of being defined as real in the database. For example, 
> for the last point (#19) I get:
> xcoord = -58
> ycoord = -34
> when the actual value is:
> x = -58.904272
> y = -34.447837
> 
> As a result of this, when I test the mapfile with SHP2IMG all 20 points 
> are in the same place (all with the same coordinate values; e.g. x,y = 
> -58,-34)
> 
> I am making some mistake?
> My syntax is correct?
> Is there someone to give me a hand on this problem?

Gaston,

I would encourage you to install and test the same  .ovf with ogrinfo
from FWTools 1.1.3 to establish whether it might be related to the
version of GDAL.

If FWTools 1.1.3 gives the same results, then I would suggest running
ogrinfo with the CPL_DEBUG environment variable set to ON.  This should
dump out some extra debugging info, such as the SQL commands being run,
that might be helpful.

I suspect it is either a subtle ODBC field type related issue that might
be fixed in a newer version or a numeric locale issue - numbers coming
back with commas instead of periods for decimal seperators and this
parsing wrong.

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    | President OSGeo, http://osgeo.org



More information about the ms4w-users mailing list