MAP
	
	NAME Estacions
	SIZE 512 362
	STATUS ON
	EXTENT -2.464 38.269 6.021 44.284
	PROJECTION
	   "init=epsg:4326"
	END

	FONTSET "../misc/fonts/fonts.txt"
	SYMBOLSET "../misc/symbols/symbols.sym"
		
	TRANSPARENT true
	OUTPUTFORMAT
		NAME "kml"
		DRIVER "OGR/KML"
		#MIMETYPE "application/wnd.google-earth.kml.xml"
		#IMAGEMODE RGB
		FORMATOPTION "FILENAME=result.kml"
		EXTENSION "kml"
	END

	OUTPUTFORMAT
		NAME "shape"
		DRIVER "OGR/ESRI Shapefile"
		FORMATOPTION "STORAGE=memory"
		FORMATOPTION "FORM=zip"
		FORMATOPTION "FILENAME=result.zip"
	END

	OUTPUTFORMAT
		NAME "CSV"
		DRIVER "OGR/CSV"
		MIMETYPE "text/csv"
		FORMATOPTION "LCO:GEOMETRY=AS_WKT"
		FORMATOPTION "STORAGE=filesystem"
		FORMATOPTION "FORM=simple"
		FORMATOPTION "FILENAME=result.csv"
	END

	OUTPUTFORMAT
		NAME "CSVSTREAM"
		DRIVER "OGR/CSV"
		MIMETYPE "text/csv; streamed"
		FORMATOPTION "LCO:GEOMETRY=AS_WKT"
		FORMATOPTION "STORAGE=stream"
		FORMATOPTION "FORM=simple"
		FORMATOPTION "FILENAME=result.csv"
	END

	OUTPUTFORMAT
		NAME "OGRGML"
		DRIVER "OGR/GML"
		MIMETYPE "text/xml; subtype=gml/2.1.2; driver=ogr"
		FORMATOPTION "STORAGE=memory"
		FORMATOPTION "FORM=multipart"
		FORMATOPTION "FILENAME=result.gml"
	END

	OUTPUTFORMAT
		NAME "SHAPEZIP"
		DRIVER "OGR/ESRI Shapefile"
		MIMETYPE "application/shapefile"
		FORMATOPTION "STORAGE=filesystem"
		FORMATOPTION "FORM=zip"
		FORMATOPTION "FILENAME=result.zip"
	END

	UNITS dd
	IMAGETYPE png

 
	WEB
		IMAGEPATH '/var/www/tmp/'
		IMAGEURL 'http://localhost/tmp/'
		TEMPLATE "blank.html"

		METADATA
			WMS_TITLE 									"Sensors"
			WMS_ABSTRACT 								"Sensors"
			WMS_KEYWORDLIST 						"Sensors radar meteosat estacions llamps descàrregues"
			WMS_SERVICE_ONLINERESOURCE 	"............"
			WMS_CONTACTPERSON 					"............"
			WMS_CONTACTORGANIZATION 		"............"
			WMS_CONTACTPOSITION 				"............"
			WMS_ADDRESSTYPE 						"postal"
			WMS_ADDRESS 								"............"
			WMS_CITY 										"............"
			WMS_STATEORPROVINCE 				"............"
			WMS_POSTCODE 								"............"
			WMS_COUNTRY 								"............"
			WMS_CONTACTVOICETELEPHONE 	"............"
			WMS_CONTACTFACSIMILETELEPHONE ""............"
			WMS_CONTACTELECTRONICMAILADDRESS "hsansegundo@meteo.cat"
			WMS_FEES 										"none"
			WMS_ACCESSCONSTRAINTS 			"drets d'autor"
			WMS_FEATURE_INFO_MIME_TYPE 	"text/html"
			WMS_SRS 										"EPSG:4326 EPSG:23031"
			wms_enable_request 					"*"


			##########       WFS
			wfs_title          					"WFS Sensors"
			wfs_onlineresource 					"http://localhost/cgi-bin/mapserv?map=/var/www/mapserver/mapfile/service_sensors.map" 
			wfs_srs            					"EPSG:4326 EPSG:23031" 
			wfs_abstract       					"This text describes my WFS service." 
			wfs_enable_request 					"*"  
			queryable										"true"
			wfs_getfeature_formatlist 	"kml,shape,csv,ogrgml,shapezip"

		END

	END


	LAYER
		NAME 													"estacions_estat"
		#GROUP												"ultimes_dades"
		HEADER 												"templates/getfeatureinfo_header.html" # header html template
		TEMPLATE 											"templates/getfeatureinfo_content.html" # content html template
		FOOTER 												"templates/getfeatureinfo_footer.html" # footer html template		
		METADATA			
			wfs_include_items   					"all"	
			wfs_typename 									"estacions_estat"
			wfs_title         						"Estacions" ##REQUIRED
			wfs_srs           						"EPSG:4326 EPSG:23031" ## REQUIRED
			wfs_extent 										"-2.464 38.269 6.021 44.284"
			wfs_enable_request						"*"
			gml_include_items 						"all" 
			gml_featureid     						"rownum" ## REQUIRED
			wfs_enable_request 						"*"
			wfs_service 									"WFS"	
			ows_title 										"Estacions"
			wms_feature_info_mime_type 		"text/html"
			wms_extent 										"-2.464 38.269 6.021 44.284"
			gml_include_items 						"all"			
			wms_include_items   					"all"	
			#wms_group_title							"Estacions"

			'estat_validation_pattern'				"[A-Z0-9._%+-|'\(\)]"
			'tipus_validation_pattern'				"[A-Z0-9._%+-|'\(\)]"

			'default_estat'										'null'
			'default_tipus'										'A'

		END

		VALIDATION

			'estat'														"[A-Z0-9._%+-|'\(\)]"
			'tipus'														"[A-Z0-9._%+-|'\(\)]"

		END

		STATUS off
			
		PROJECTION
	   		"init=epsg:4326"
		END

	  CONNECTIONTYPE oraclespatial
	  INCLUDE 	"./includes/connections/conn_xema.map" 
	  DATA "the_geom from (select rownum,a.ora_geometry the_geom,a.codi_estac,a.nom_estaci,b.altitud, b.codi_estat_est, b.codi_xarxa,a.codi_tipus 
                         FROM est_4326 a, (select *
                         from table(pk_dades_estacions.torna_estacions(null,'%tipus%',null,null,null,null,%estat%,null,to_char(sysdate,'dd/mm/yyyy hh24:mi:ss'),null))) b
                         where a.codi_estac=b.codi_estacio) USING UNIQUE rownum SRID 4326" 

		TYPE POINT
		labelitem	'codi_estac'
		INCLUDE 	"./includes/paletes/xema/xema_estacions.map"


	END



END
