Accessing database views through Virtual Spatial Data Connection

Thomas Rokkjaer thomas.rokkjaer at GMAIL.COM
Fri Jul 13 00:58:18 PDT 2007


I am now trying to retrieve the data from a database view (SQL Server) 
instead of a database table. This is possible right?

My LAYER definiton from map file looks like the following:
#
# HENVENDELSE (OGR) LAYER
#
LAYER
        CONNECTION "<OGRVRTDataSource>
        <OGRVRTLayer  name='DVHenvendelse_v'>
        <SrcDataSource>ODBC:test/test at DVHenvendelse</SrcDataSource>
        <SrcLayer>DVHenvendelse_v</SrcLayer>
        <GeometryField encoding='PointFromColumns' x='XKoordinat' 
y='YKoordinat'/>
        <GeometryType>wkbPoint</GeometryType>
        </OGRVRTLayer>
        </OGRVRTDataSource>"
        CONNECTIONTYPE OGR
        DATA "DVHenvendelse_v"
        METADATA
                "wms_srs"   "EPSG:25832"
                "wms_title"   "DVHenvendelse_v"
        END
        NAME "DVHenvendelse_v"
        SIZEUNITS PIXELS
        STATUS ON
        TOLERANCE 0
        TOLERANCEUNITS PIXELS
        TYPE POINT
        UNITS METERS

        CLASSITEM 'Skadedyr'
				
	LABELITEM 'ID'
	LABELMAXSCALE 25000				
       
        CLASS
	    LABEL
	      	COLOR  0 0 0
	      	FONT arial
	      	TYPE truetype
	      	SIZE 8
	      	POSITION AUTO         
	      	PARTIALS TRUE
	      	OUTLINECOLOR 255 255 255
	    END
        
            EXPRESSION 'N'
            
            STYLE
        	COLOR 255 255 0
            	MAXSIZE 100
            	MINSIZE 1
            	SIZE 8
            	SYMBOL "punkt"
            END
            
	    TEXT (([ID]) [Vejnavn] ([DVOpgaveID]))
        END        
        
        CLASS
	    LABEL
	      	COLOR  0 0 0
	      	FONT arial
	      	TYPE truetype
	      	SIZE 8
	      	POSITION AUTO         
	      	PARTIALS TRUE
	      	OUTLINECOLOR 255 255 255
	    END
	    
	    EXPRESSION 'J'
	    
            STYLE
              	COLOR 139 69 19
             	MAXSIZE 100
             	MINSIZE 1
             	SIZE 8
             	SYMBOL "punkt"
            END
            
	    TEXT (([ID]) [Vejnavn] ([DVOpgaveID]))

        END

	HEADER 'header'
   	TEMPLATE 'template.html'
   	FOOTER 'footer.html'
END

Best regards
Thomas Rokkjaer



More information about the MapServer-users mailing list