[Mapserver-users] Joining geospatial data to attribute data as basis for layer defi nition

Pryor, Clayton J CJPRYOR at sandia.gov
Tue Oct 7 07:19:46 PDT 2003


Hi all,

I am building a prototype application in MapServer to evaluate whether we
should migrate from ArcIMS or not.  One of the requirements of this
application is to render colors of geospatial data based on attributes in a
table outside of the geospatial data.  In ArcIMS I defined these types of
layers as a SPATIALQUERY in the layer definition (as shown below).

<LAYER type="featureclass" name="NERC Subregions" visible="true" id="3">
	<DATASET name="SDE.NERCSUBREGIONS" type="polygon"
workspace="sde_ws-24" />
	<SPATIALQUERY
	subfields = "LIMITEDINSIST.NERC_SUBREGION_LKUP.NERCRGN
        		LIMITEDINSIST.NERC_SUBREGION_LKUP.NERCSRGN
	        	LIMITEDINSIST.EP_STATUS_BY_SUBREGION.STATUS_VALUE
	        	LIMITEDINSIST.EP_STATUS_BY_SUBREGION.DATE_CHANGED
	        	LIMITEDINSIST.EP_STATUS_BY_SUBREGION.DATE_VERIFIED
		OBJECTID
		#SHAPE#"
        where="SDE.NERCSUBREGIONS.OBJECTID =
LIMITEDINSIST.NERC_SUBREGION_SPATIAL_LINK.NERC_SPATIAL_ID
	        and LIMITEDINSIST.NERC_SUBREGION_LKUP.NERC_SUBREGION_ID =
LIMITEDINSIST.NERC_SUBREGION_SPATIAL_LINK.NERC_SUBREGION_ID
	        and LIMITEDINSIST.EP_STATUS_BY_SUBREGION.NERC_SUBREGION_ID =
LIMITEDINSIST.NERC_SUBREGION_LKUP.NERC_SUBREGION_ID
	        and LIMITEDINSIST.EP_SUBREGION_CONTACTS.NERC_SUBREGION_ID =
LIMITEDINSIST.NERC_SUBREGION_LKUP.NERC_SUBREGION_ID
        jointables="LIMITEDINSIST.NERC_SUBREGION_SPATIAL_LINK
		LIMITEDINSIST.NERC_SUBREGION_LKUP
		LIMITEDINSIST.EP_STATUS_BY_SUBREGION
	        	LIMITEDINSIST.EP_SUBREGION_CONTACTS" />
	<VALUEMAPRENDERER
lookupfield="LIMITEDINSIST.EP_STATUS_BY_SUBREGION.STATUS_VALUE">
	  <RANGE lower="0.0" upper="0.2" label="...">
	    <SIMPLEPOLYGONSYMBOL  fillcolor="255,0,0"
boundarycaptype="round" boundarywidth="2"/>
	  </RANGE>
	  <RANGE lower="0.2" upper="0.4" label="...">
	    <SIMPLEPOLYGONSYMBOL  fillcolor="255,125,0"
boundarycaptype="round" boundarywidth="2"/>
	  </RANGE>
	  <RANGE lower="0.4" upper="0.6" label="...">
	    <SIMPLEPOLYGONSYMBOL  fillcolor="255,255,0"
boundarycaptype="round" boundarywidth="2"/>
	  </RANGE>
	  <RANGE lower="0.6" upper="0.8" label="...">
	    <SIMPLEPOLYGONSYMBOL  fillcolor="50,50,255"
boundarycaptype="round" boundarywidth="2"/>
	  </RANGE>
	  <RANGE lower="0.8" upper="1.0" label="...">
	    <SIMPLEPOLYGONSYMBOL  fillcolor="0,255,0"
boundarycaptype="round" boundarywidth="2"/>
	  </RANGE>
	  <OTHER label="Status not determined">
	   <SIMPLEPOLYGONSYMBOL  fillcolor="200,200,200"
boundarycaptype="round" boundarywidth="2"/>
	  </OTHER>
	  <EXACT value="-99" label="Error in receipt of data">
	   <SIMPLEPOLYGONSYMBOL  fillcolor="0,0,0" boundarycaptype="round"
boundarywidth="2"/>
	  </EXACT>
	</VALUEMAPRENDERER>
      </LAYER>

In my review of the MapServer documentation and discussions, I found a post
in 2001 that addresses the subject.  In part, it reads as follows:

"No joins are supported for classification purposes.  You can only use
directly attached attributes.  This was done for performance reasons."

I have a few questions.

1)  Is this statement still true?

2)  What exactly are "directly attached attributes?"  I did a search for
this term and could find nothing.  I am assuming this means that the
attributes must be part of the geospatial data table.

3)  How would you go about defining the equivalent to the above ArcIMS layer
definition in a MapServer application?  In this question, I am concerned
about the join.  I have seen examples of how to reference a singe geospatial
table and how to set up color classifications based on attribute values.

4)  One thing I haven't explored is the possibility of handling the join at
the database level and then referencing the resulting join in the map
definition.  Will that work?

Thanks in advance for any help.

Sincerely,

Clay


   ------------------------------------------------------------
   Clayton J. Pryor	phone	(505) 845-3557
   Sandia National Laboratories	
   Critical Infrastructure Surety 	fax	(505) 844-9641
   PO Box 5800 MS 0451			 
   Albuquerque NM 87185-0451	email	cjpryor at sandia.gov
   ------------------------------------------------------------





More information about the MapServer-users mailing list