[mapserver-users] Re: [UMN_MAPSERVER-USERS] OGR connection problem

Tamas Szekeres szekerest at gmail.com
Wed Mar 26 16:49:42 EDT 2008


Hi,

I'm not sure whether msscmd produces such wkb format that is readable
by the OGR ODBC driver at the moment. What is the type of the column
it generates for the wkb geometries? I think you should instead try
using the mssql2008 plugin driver of mapserver or you could also try
producing wkt text fields to be accessed by OGR ODBC.

Best regards,

Tamas



2008/3/26, Milton César de Souza Leite <miltonleite at mec.gov.br>:
> I'm trying to use MS SQL Server 2005 Express with Mapserver
>  using the virtual spatial data (ODBC/ovf).
>  So far, I used the MsSqlSpatial for importing and dealing with
>  the shapefile. The shapefile in question contains the geometryies
>  of brazilian counties with their coordenates (latlong) as well as their
>  city halls.
>
>  I installed the SQL Server, and created a database named "geodados",
>  user "geouser"
>  and password "123456".
>
>  For importing, I used the following:
>
>  msscmd -deploy -server=SOYUZ\SQLEXPRESS -db=geodados
>
>  msscmd -server=SOYUZ\SQLEXPRESS -db=geodados -table=municipios
>  -import=shp -shp_filename="55mu2500gc.shp"
>
>  and, it executed without a problem.
>
>  After that, I created an ODBC connection (System DSN with SQL Native
>  Client)
>
>  For testing it, I used the following ovf files:
>
>  - For Polygons that represents the brazilian Counties(municipios):
>  ====================================================
>  <OGRVRTDataSource>
>   <OGRVRTLayer name="municipios">
>     <SrcDataSource>ODBC:geouser/123456 at SQLEXPRESS</SrcDataSource>
>     <SrcLayer>municipios</SrcLayer>
>     <SrcSQL>SELECT oid, the_geom FROM municipios WHERE geocodigo =
>  1500602</SrcSQL>
>     <LayerSRS>EPSG:4291</LayerSRS>
>     <FID>oid</FID>
>     <GeometryType>wkbPolygon</GeometryType>
>     <GeometryField encoding="WKB" field="the_geom"/>
>   </OGRVRTLayer>
>  </OGRVRTDataSource>
>
>  - For Points, that represents the city halls (sedes):
>
>  <OGRVRTDataSource>
>   <OGRVRTLayer name="sedes">
>     <SrcDataSource>ODBC:geouser/123456 at SQLEXPRESS</SrcDataSource>
>     <SrcLayer>sedes</SrcLayer>
>     <SrcSQL>SELECT oid, ST.GeomFromText('POINT( ' + longitude + ' ' +
>  latitude + ' )', 4291) AS the_geom FROM municipios</SrcSQL>
>     <LayerSRS>EPSG:4291</LayerSRS>
>     <FID>oid</FID>
>     <GeometryType>wkbPoint</GeometryType>
>     <GeometryField encoding="WKT" field="the_geom"/>
>   </OGRVRTLayer>
>  </OGRVRTDataSource>
>
>  The mapfile structure is:
>
>  #################################################################################
>
>
>  MAP
>  NAME "Brasil"
>  CONFIG "CPL_DEBUG" "ON"
>  SIZE 600 600
>  STATUS ON
>  EXTENT -73.990250 -33.751583 -28.835656 5.272156
>  UNITS METERS
>
>  WEB
>  IMAGEPATH "C:/Arquivos de programas/ms4w/Apache/htdocs/brasil/imagens"
>  IMAGEURL "/brasil/imagens"
>  END
>
>  LEGEND
>  STATUS ON
>  END
>
>  LAYER
>  NAME "municipios"
>  DEBUG ON
>  STATUS ON
>  TYPE POLYGON
>  CONNECTIONTYPE OGR
>  CONNECTION "teste.ovf"
>  DATA "municipios"
>  LABELMAXSCALE 1500000
>  LABELCACHE ON
>
>  TRANSPARENCY 100
>
>  CLASS
>  LABEL
>  MINFEATURESIZE 10
>  COLOR 10 255 150
>  OUTLINECOLOR 0 0 0
>  END
>  END
>
>  TEMPLATE "none.htm"
>  METADATA
>  TEMA "brasil"
>  CLASSE "SIM"
>  TEXTO "SIM"
>  ESCALA "250000"
>  END
>
>  END
>
>  LAYER
>  NAME "sedes"
>  STATUS ON
>  TYPE POINT
>  CONNECTIONTYPE OGR
>  CONNECTION "teste1.ovf"
>  DATA "sedes"
>  LABELMAXSCALE 1500000
>  LABELCACHE ON
>
>  TRANSPARENCY 100
>
>  CLASS
>  LABEL
>  MINFEATURESIZE 10
>  OUTLINECOLOR 255 255 255
>  END
>  STYLE
>  SIZE 10
>  COLOR 10 255 150
>  OUTLINECOLOR 10 255 150
>  END
>  END
>
>  METADATA
>  TEMA "sedes"
>  CLASSE "SIM"
>  TEXTO "SIM"
>  ESCALA "250000"
>  END
>
>  END
>
>  END
>
>  #################################################################################
>
>
>  Unfortunately I'm only able to generate the Points showing the city halls,
>  not the Polygons showing the counties.
>  I really appreciate any help, on how to solve this problem.
>
>  Best Regards,
>
>
>  MCSL
>
>


More information about the mapserver-users mailing list