Announcement

Collapse
No announcement yet.

WMS Feature Query Tool

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • WMS Feature Query Tool



    http://pneumatictu.be/WMSQuery.cs

    This plugin lets you query a WMS server for feature information. To use it, select a wms-based layer from the treeview and right click on the map. The response from the server will appear in the web browser. If you select a non-wms item then the right-click will do nothing. A small red square will appear on the map where your click landed.

    Not every server supports all three response format options, so if you get an error (or a blank web browser panel) then try a different format. I think the XML choice should always show you something, even if it is just empty tags or an error.

    Every server varies in how it handles the precision of the request, so you may get more than one feature returned (the maximum is set to 10 features). If you are trying to query point data and are getting no features returned then zoom closer and try again.

    Issues:
    *There is no way to detect whether there was a double-click, so turn off the query checkbox before using a double right-click to zoom out.
    *1.4.0.1 has the new raytracing code to make click locations accurate on the globe but 1.4 doesn't, so in 1.4 set the terrain exaggeration to zero to make sure your click lands where you think it will.
    *WW will be unresponsive while the query is download. I can do the download asynchronously, but then there are errors when opening the browser panel from the other thread. So that is on the to-do list.

    Thanks to geodan and Servir-Viz for the original code.
    Last edited by withak; 04-26-2007, 12:21 AM.

  • #2
    style sheet

    Hey, do you want the style sheet i was using?..or are you not running it through the client side transformation?

    that's looking good by the way.

    Comment


    • #3
      I'm not doing anything client-side, just saving the result to a temp file and passing the temp file path to the browser. That's a temporary fix; eventually I want to make a separate window of some kind pop up with the result so that the request can be asynchronous and not freeze up WW while it works.

      Comment


      • #4
        Oh, ok. I was putting the text through a stylesheet so it looked a bit nicer. Couldn't we do that inside another thread?

        Comment


        • #5
          Yeah, but you can't update the main gui from that other thread without getting errors.

          Comment


          • #6
            Originally posted by withak View Post


            http://pneumatictu.be/WMSQuery.cs

            This plugin lets you query a WMS server for feature information. To use it, select a wms-based layer from the treeview and right click on the map. The response from the server will appear in the web browser. If you select a non-wms item then the right-click will do nothing. A small red square will appear on the map where your click landed.

            Not every server supports all three response format options, so if you get an error (or a blank web browser panel) then try a different format. I think the XML choice should always show you something, even if it is just empty tags or an error.

            Every server varies in how it handles the precision of the request, so you may get more than one feature returned (the maximum is set to 10 features). If you are trying to query point data and are getting no features returned then zoom closer and try again.

            Issues:
            *There is no way to detect whether there was a double-click, so turn off the query checkbox before using a double right-click to zoom out.
            *1.4.0.1 has the new raytracing code to make click locations accurate on the globe but 1.4 doesn't, so in 1.4 set the terrain exaggeration to zero to make sure your click lands where you think it will.
            *WW will be unresponsive while the query is download. I can do the download asynchronously, but then there are errors when opening the browser panel from the other thread. So that is on the to-do list.

            Thanks to geodan and Servir-Viz for the original code.

            Hi !

            I was searching the way to get the info from a WMS Server, fortunately i saw their post (Geodan and Withak). But when i want to download the "WMS Feature Query Tool" plugin from http://pneumatictu.be/WMSQuery.cs i can´t access to the link, could you tell me please another link where i can get it ? and which are the steps that i have to follow ?

            Another question: I want to do the same but with shapefiles, to get info from shapefiles, do you know how to do it ?

            Thanks in advanced.

            Comment


            • #7
              WMS Query

              Hi there, I'm not sure about his WMSQuery.cs file. Although, you could simply use SERVIR Viz which has several nice tools, including an easy to use WMS tool. It also allows you to do simple WMS GetFeatureInfo requests, i.e. "a map identify" for feature attributes.

              SERVIR Viz is built off of WorldWind .NET version 1.4. WorldWind plugins designed for that version will work in Servir Viz as well

              http://www.servir.net/index.php?opti...mid=32&lang=en

              You could always IM withak for the file too...

              Comment


              • #8
                Yeah ! i saw the Server Viz....very nice project and very interesting , but i´m working in my own project from WW, then i want to know how i get info from a WMS server and from a shapefile, may you tell me what do i have to do ?

                Comment


                • #9
                  As for a shapefile, not sure, but you could try looking for open source .net libraries that utilize shapefiles (sharpmap perhaps).

                  As for WMS, you'll want to look up and support the GetFeatureInfo request ...which is part of the WMS spec. For example, the GetMap request is the one that returns the map images. The GetFeatureInfo request returns attributes for a given x,y location (i.e. a clicked point)

                  This link has the breakdown of what the URL for a GetFeatureInfo request looks like. Then, all you'll need to do is have your plugin get the x,y location that you clicked at...and formulate the URL...

                  http://webhelp.esri.com/arcims/9.2/g...eatureinfo.htm

                  Good luck,
                  Dan

                  Comment


                  • #10
                    I have doubts and somethings i don´t have it clear still. I saw your post from http://forum.worldwindcentral.com/sh...ght=attributes, where you have an image screenshot.JPG. I want to do that exactly. May you tell me what do i have to do and what are the steps to follow ? do i have to change the source code ?

                    Comment


                    • #11
                      Well, one you formulate the URL request for the GetFeatureInfo. It will send you back some XML content. You just need to take that XML content and style it a little bit, so it looks nice in the browser. I believe I took the text/xml response, and used the XslCompiledTransform object in C# to style the attributes into a table.

                      Once I have the html content to display in the internal browser, I use this code to browse to it:

                      SplitContainer sc = (SplitContainer)theDrawArgs.parentControl.Parent.Parent ;
                      InternalWebBrowserPanel browser = (InternalWebBrowserPanel)sc.Panel1.Controls[0];
                      browser.NavigateTo(content);

                      Ask specific questions if you aren't sure on something.

                      Comment


                      • #12
                        I´m thankful for your patience cause i´m new in c#. Ok, i added an url Wms to my layer manager and i can see the information, it back to me an Xml file, but i don´t know which is the next step after that. What do i have to do with Xml file ? What do you refers with XslCompiledTransform object in C# ? i searched the object in WW code and i didn´t find it.

                        Comment


                        • #13
                          The XslCompiledTransform object is a C#.NET class. It's not a worldwind class. It's code that you'd need to implement...feeding your XML response from the GetFeatureInfo request.

                          That class will help you convert ugly boring XML to nice graphic HTML.

                          http://msdn.microsoft.com/en-us/library/0610k0w4.aspx

                          Dan

                          Comment


                          • #14
                            Hi Dan !

                            Originally posted by geodan View Post
                            The XslCompiledTransform object is a C#.NET class. It's not a worldwind class. It's code that you'd need to implement...feeding your XML response from the GetFeatureInfo request.

                            That class will help you convert ugly boring XML to nice graphic HTML.

                            http://msdn.microsoft.com/en-us/library/0610k0w4.aspx

                            Dan
                            Hi Dan !

                            I´ve visited the link that you passed to me and i understand the XslCompiledTransform class function. I know that XslCompiledTransform class transform an Xml to html file, i´ve tried to implement the code into my source code, but my inexperience has brought to me serious troubles. Do you know an easier way to do it ? or can you be more desriptive in your comments ? i´m sorry but i don´t understand several things still.

                            Comment

                            Working...
                            X