[mapserver-users] Inefficient rendering of layer

juliap japr94 at hotmail.com
Tue Mar 27 13:17:33 EDT 2012


Hi all,

I want to style a layer based on the political party that is winning for all
shapes in a database.

My layer looks like this: 

	LAYER
	   NAME votes
	   TYPE POLYGON
	   CONNECTIONTYPE OGR	
	   CONNECTION "MSSQL:..." 
	   DATA "SELECT geom , VotingFor FROM dbo.[BF_PROV_ELECTORAL_DIVISION] AS
elec WITH (INDEX(ogr_geom_sidx)) JOIN dbo.[Survey] ON GeoL.STWithin(geom) =
1 
        WHERE PartyVotingFor = 
         ( SELECT TOP 1 [VotingFor] FROM dbo.[BF_PROV_ELECTORAL_DIVISION] AS
elec2 WITH (INDEX(ogr_geom_sidx)) JOIN dbo.[Survey] ON GeoL.STWithin(geom) =
1 
			WHERE VotingFor <= '4' AND elec.ID = elec2.ID
			GROUP BY VotingFor
			ORDER BY COUNT(VotingFor)DESC
          )"    		
		 
		CLASS 
	     
		EXPRESSION ([PartyVotingFor] = 1 )
		STYLE			    
			COLOR    34 139 34
		END
    END
	CLASS 
	   
		EXPRESSION ([PartyVotingFor] = 2 )
		STYLE
		   	COLOR    24 116 205
		END
    END
	CLASS 
	    
		EXPRESSION ([PartyVotingFor] = 3 )		
		STYLE    
			COLOR    255 127 0
		END
    END
	CLASS 
	   
		EXPRESSION ([PartyVotingFor] = 4 )		
		STYLE		
			COLOR    46 46 46
		END
    END
	   PROJECTION
		"init=epsg:4326" 
	   END # end of projection
	END # end of layer

The problem is that the rendering of this layer takes about 7minutes . Is
there a way to make this query more efficient?, or perhaps an alternative
and more efficient way to deal with this problem?

Thanks,

Julia 

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Inefficient-rendering-of-layer-tp4661670p4661670.html
Sent from the Mapserver - User mailing list archive at Nabble.com.


More information about the mapserver-users mailing list