My project is coming along nicely! A brief background on my project. I have a world map that is colored to show the country of origin of the students at a college. Each color represents the number students (a range). E.g. any country colored red has 1 to 20 students at the college. When you click on a country, I was successful in displaying data specific to that country in a pop-up.

Hopefully I can describe what I want to do next.... I want to add the ability to query the map such that the countries that satisfy the query will be highlighted on the map.
So for example, in my html form I enter > 300... click on submit.... England, India and USA are highlighted. I've figured out that I need to use WFS getFeature but as you can see it's the how that I need help with...

Can anyone direct me to an example of the above or give me some suggestions, I would be most appreciative.

I am using MapSever, PostGIS and Openlayers


  • So you have built a Mapserver WMS and want to highlight certain features (dependent on queries) on the map? – underdark Dec 12 '10 at 21:11
  • Yeah!! you hit the nail on the head!! Any ideas as to how I can do it? – ChrisJ Dec 12 '10 at 21:17
  • I don't get the title. What are you doing with shapefiles? You say you have your data in PostGIS. – Nicklas Avén Dec 12 '10 at 22:10
  • 2
    If you are using WMS/WFS then the fact your data is in postgis is irrelevant. – Ian Turton Dec 12 '10 at 23:15

Maybe "Drawing selected features in Mapserver with mapscript" can get you started.

Mapserver's Querymap feature seems to be another way to go.

|improve this answer|||||

I don't know how to do it through a wms-service, but Mapserver has the ability to both handle a custom sql-query for getting the data (take a look at the third and fourth example here)

, and you can use run-time substitution to insert some value from the client into that query. I remember I struggled some to get it working because I missed the validation against the datapattern. You can read about that here.

HTH Nicklas

|improve this answer|||||
  • Nicklas: Thanks for the reply... I think I have the MAP and MAPSCRIPT files set up correctly.... My problem is with openlayers... I don't know how to setup/define the vector layer. I looked at the various openlayers examples but could get any to work for me... Are there any openlayers examples that uses mapserver I can review?? – ChrisJ Dec 12 '10 at 23:36
  • @Chris: did you solve this problem. I am struggeling with the same issue in OpenLayers. – Stefan Jan 14 '13 at 11:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.