[ka-Map-users] Querying dbf files
JayDub
justcallmejay at gmail.com
Fri Oct 26 13:32:03 EDT 2007
Hi I've got a dbf file I wanna query. Just so it's clear exactly I wanna do
lemme explain.
- Point and click on say a road... and get back the name of the road
- Perform a search for a part of a road name and get back results and gps
coords that may be zoomed to
I updated my map file... the relevant layer is shown below
I have the layer in a group called "Roads", I put in the meta data fields
"queryable", "SEARCHFIELD" and "fields".....
I've also tried using the javascript function pasted below. However
/cgi-bin/ doesn't exist on my server. So the popup does no good. Umm... the
alert works... shows me gps data and so on and so forth, but just not data
I'm convinced came from the dbf file. How can I extend on what's already
there to include some searching facilities like what I described?
I read about doing up the template but I think first I need to get /cgi-bin/
somehow setup to point to mapserver. I should also throw this in, I'm using
Linux... Ubuntu. Ne advice will be greatly appreciated.
LAYER #Kgn_rds_qc.shp
TRANSPARENCY 100
NAME 'kgn_rds_qc.shp'
METADATA
gix_layername "kgn_rds_qc.shp"
gix_layerfieldnames "LABEL|TYPE|CLASS|ONEWAY"
gix_layerfieldalias "Label|Type|Class|Oneway"
"queryable" "true"
"opacity" "50"
"SEARCHFIELD" "LABEL"
"fields" "LABEL:Label,TYPE:Type,CLASS:Class,ONEWAY:Oneway"
END #METADATA
TOLERANCE 3
TOLERANCEUNITS pixels
DATA 'kgn_rds_qc.shp'
HEADER 'header.html'
FOOTER 'footer.html'
LABELCACHE on
LABELITEM 'Label'
CLASSITEM 'Class'
STATUS ON
DEBUG false
TRANSFORM true
TYPE line
CLASS # class for primary roads
EXPRESSION ('[CLASS]' eq 'Primary Road' AND '[LABEL]' ne 'Road')
NAME 'kgn_rds_qc.shp'
# MINSCALE 100000.05
TEMPLATE 'templated.html'
#PEN
STYLE
SYMBOL 'Kgn_rds_qc--0--0'
SIZE 3
# COLOR 150 25 25
COLOR 0 0 70
OUTLINECOLOR 255 255 255
END #STYLE
LABEL
ANGLE auto
ANTIALIAS true
OUTLINECOLOR 220 220 255
BACKGROUNDSHADOWSIZE 1 1
BUFFER 1
COLOR 150 10 150
ENCODING "ISO-8859-1"
FONT "Verdana"
FORCE false
MINFEATURESIZE 100
MINDISTANCE 100
POSITION auto
SIZE medium
#TYPE truetype
END
END #CLASS
CLASS # class for other roads
EXPRESSION (('[CLASS]' eq 'Secondary Road') OR ('[CLASS]' eq 'Other
Road') AND '[LABEL]' ne 'Road')
#EXPRESSION /Secondary Road|Other Road/
NAME 'kgn_rds_qc.shp'
MAXSCALE 20000
TEMPLATE 'templated.html'
#PEN
STYLE
SYMBOL 'Kgn_rds_qc--0--0'
SIZE 1
# COLOR 150 25 25
COLOR 25 25 25 # dark grey roads
END #STYLE
LABEL
ANGLE auto
ANTIALIAS true
OUTLINECOLOR 255 255 255
BACKGROUNDSHADOWSIZE 1 1
BUFFER 1
COLOR 70 70 250
ENCODING "ISO-8859-1"
FONT "Verdana"
FORCE false
MINFEATURESIZE 100
POSITION auto
SIZE medium
END
END #CLASS
GROUP "Roads"
END #LAYER
myQuery = function( eventID, queryType, coords )
{
myKaMap = mapInstance;
var szLayers = '';
var layers = mapInstance.getCurrentMap().getQueryableLayers();
if(layers.length==0) {
alert("No queryable layers at this scale and extent");
return;
}
for (var i=0;i<layers.length;i++) {
szLayers = szLayers + "," + layers[i].name;
}
var extent = myKaMap.getGeoExtents();
var scale = myKaMap.getCurrentScale();
var cMap = myKaMap.getCurrentMap().name;
var
params='map='+cMap+'&q_type='+queryType+'&scale='+scale+'&groups='+szLayers+'&coords='+coords+'&extent='+extent[0]+'|'+extent[1]+'|'+extent[2]+'|'+extent[3];
window.open("/cgi-bin/mapserv?map=" + cMap +
"&layers=all&mode=query&mapxy=" + coords);
alert( "Map: " + cMap + " | Scale: " + scale + " | Extent: " + extent + "
| QUERY: " + queryType + " " + coords + " on layers " + szLayers );
}
mapInstance.registerForEvent( KAMAP_QUERY, null, myQuery );
--
View this message in context: http://www.nabble.com/Querying-dbf-files-tf4698735.html#a13431948
Sent from the ka-map-users mailing list archive at Nabble.com.
More information about the ka-Map-users
mailing list