spatial query using GeoExt and openlayers

المشرف العام

Administrator
طاقم الإدارة
I want to allow the the User to make advanced custom queries against a layer.So he can search by name or another attribute and get zoomed to the requested feature ( hospital in my case) .

I m working with GeoEXt and openlayers in client side .. i build queries with php .My database is stored in potgis and as server i'm using Geoserver.

And there is what i tried : php query

var centre = new OpenLayers.Layer.Vector("centres",{ protocol: new OpenLayers.Protocol.HTTP({ url: ".//test.php", format: new OpenLayers.Format.GeoJSON( { internalProjection: epsg900913, externalProjection: epsg4326} )}), strategies: [new OpenLayers.Strategy.Fixed()] });gridStore = new Ext.data.JsonStore({ url : './/test.php', // script d'acces a la base fields : ['name','geom'], autoLoad : true, storeId: 'gridStore'});// ComboBox :var igtCombo = new Ext.form.ComboBox({ id : 'igtCombo', fieldLabel : "research an hospital", triggerAction : 'all', emptyText : "enter name of an hospital ", editable : false, store : gridStore, mode : 'local', displayField : 'name', width : 240, height : 35, valueField : 'lieu' }); // Button creation : var submitButton = new Ext.Button({ text : 'show in the map', width : 100, height : 35,// boutton clickhandler: function(){ var x = Ext.getCmp('x').getRawValue(); var y = Ext.getCmp('y').getRawValue(); map.setCenter(new OpenLayers.LonLat(x,y), NiveauDeZoom); markers = new OpenLayers.Layer.Markers("Marker"); map.addLayer(markers); //Creation du Marker pos = new OpenLayers.LonLat(x,y); map.setCenter(pos, 11); feature = new OpenLayers.Feature(centre, pos); marker = feature.createMarker(); markers.addMarker(marker); }, renderTo: Ext.getBody()});As i'm beginner with these solutions i'm struggling to make that work.



أكثر...
 
أعلى