Hi, This was too hard case for me so I made a little research about existing solutions for getting GetFeatureInfo into JUMP family programs.
First a little background about what GetFeatureInfo does. It is an optional WMS feature and rather loosely defined in the WMS standard. In practice user reads a map from WMS server and clicks a point on a map and server sends some information about a feature that is located at a clicked point. GetFeatureInfo requests is almost the same as GetMap request and here follows an example which works with Geoserver 2.3.0 demo layer. http://localhost:8080/geoserver/wms? SERVICE=WMS& REQUEST=GetFeatureInfo& SERVICE=WMS& VERSION=1.1.1& WIDTH=459& HEIGHT=351& LAYERS=topp:states& TRANSPARENT=TRUE& FORMAT=image%2Fpng& BBOX=-124.731,15.078911764705884,-66.97,59.24908823529412& SRS=EPSG:4326& STYLES=& QUERY_LAYERS=topp:states& X=200& Y=170& INFO_FORMAT=text/plain& FEATURE_COUNT=5 What is different or additional when compared with GetMap is - The request is GetFeatureInfo instead of GeoMap - New parametes QUERY_LAYERS is listing the layers to query - Parameters X and Y give the pixel coordinates of the clicked point. Top left corner of the map is 0,0. - The format of the returned data is selected with INFO_FORMAT. Supported formats are reported in the service GetCapabilities. Standard does not say anything about the formats. There are no compulsory formats to support nor any default format. - FEATURE_COUNT sets the maximum for from how many features the info is returned. Parameter is optional and the default value is 1. It is often good to use a bigger FEATURE_COUNT or otherwise it is not possible to get info about all overlapping areas. DeeJUMP plugin contains GetFeatureInfo tool. However, it is always using GML as INFO_FORMAT. GML sends also the geometry of the feature with the result and it makes it possible to do a nice visual effect by flashing the feature on the map. However, not all WMS servers support GML as output and client must be able to parse GML and with WMS 1.3.0 it is complicated because when parsing the geometry also the axis order must be handled. DeeJUMP plugin need deegree2.jar for handling the GML parsing and it is rather heavy dependency. I believe that the code for building GetFeatureInfo is in the source code in de/latlon/deejump/data/InfoRequest.java but I do not believe this would be the best option for adding GetFeatureInfo into OpenJUMP. By the way , the deeJUMP code is perhaps no more online but I happened to find sources from my own computer. Kosmo GIS has also a GetFeatureInfo tool and it seems to be simple. The source code is in saig-core/src/com/vividsolutions/wms/FeatureInfoRequest.java. It is mostly a copy of MapRequest.java in the same directory and I suppose it could be reusable in OpenJUMP relatively easy. If somebody gets interested I would like to give some hints. - OpenJUMP supports now also WMS 1.3.0 and that version changed the GetFeatureInfo parameters X and Y into I ja J. - Info formats should be parsed from the GetCapabilities but I would limit the support to only text/plain and text/html because I believe that OpenJUMP does not know what to do with json or GML 3.1 or other more exotic info formats. It would be good it text and html could be shown inside OpenJUMP without opening external viewers. - Servers are often buggy with GetFeatureInfo so it would be good to try to catch the exceptions. - The latest source of Kosmo is for version 2.0.1 but version 2.1 should be released before the summer and there may be some improvements with GetFeatureInfo. -Jukka Rahkonen- Michaël Michaud wrote: > > Hi Jukka, > > Here is the snippet, > > should be wrapped in a CursorTool though : > > // ------------------------------------------------------- > // Get Coordinate on click > // to prototype GetFeatureInfo > // ------------------------------------------------------- > > import java.awt.event.*; > import java.awt.geom.Point2D; > > // Listen to mouse event on the layerView > wc.layerViewPanel.addMouseListener(new MouseAdapter() { > public void mouseClicked(MouseEvent e) { > // print coordinate in the layerView > print("" + e.X + ", " + e.Y); > // convert to model Coordinate > print(wc.layerViewPanel.viewport.toModelCoordinate(new > Point2D.Double(e.X, e.Y))); > } > }); > // ------------------------------------------------------- > > Michaël > > Hi, > > > > How could I get the pixel coordinates of the clicked point inside the map > window with BeanShell? My aim is to prototype a WMS GetFeatureInfo > request and for that I would need the image coordinates of the point as X > and Y. The top left corner of the map is X=0 and Y=0. Refernce: > http://webhelp.esri.com/arcims/9.2/general/mergedProjects/wms_connect > /wms_connector/get_featureinfo.htm. > > > > -Jukka Rahkonen- > > > > ---------------------------------------------------------------------- > > -------- Precog is a next-generation analytics platform capable of > > advanced analytics on semi-structured data. The platform includes APIs > > for building apps and a phenomenal toolset for data science. > > Developers can use our toolset for easy data analysis & visualization. > > Get a free account! > > http://www2.precog.com/precogplatform/slashdotnewsletter > > _______________________________________________ > > Jump-pilot-devel mailing list > > Jump-pilot-devel@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel > > > > > > > ------------------------------------------------------------------------------ > Precog is a next-generation analytics platform capable of advanced analytics > on semi-structured data. The platform includes APIs for building apps and a > phenomenal toolset for data science. Developers can use our toolset for > easy data analysis & visualization. Get a free account! > http://www2.precog.com/precogplatform/slashdotnewsletter > _______________________________________________ > Jump-pilot-devel mailing list > Jump-pilot-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel ------------------------------------------------------------------------------ Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis & visualization. Get a free account! http://www2.precog.com/precogplatform/slashdotnewsletter _______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel