WebGIS
Design and Implementation Principles
Dr. Hua, one of the representatives of the series 2006-2-18cheungmine1What is WebGIS?My definition is the process of requesting map data or related operations from the WWW server in the Internet field to obtain and present the map to the end user. The consensus is that the client does not need to install any plug-ins (of course, the necessary browser and XML support are indispensable); the server dynamically generates a map (emphasizing this, this is because the WebGIS Engine meets industrial standards. Otherwise, it can only be called a website with map images ). The advantages of the WebGIS that meets the above definition are obvious: (1) the map is dynamically generated by the server on demand and sent to the client is only the final generated image (my experience is PNG format as well ), client requirements are minimized. (2) The central control, monitoring and audit of servers ensure data security and consistency. (3) easy deployment features, making upgrades and extensions extremely simple. Therefore, I hope that when talking about WebGIS in the future, I will never hear plug-in, ActiveX, Applet and other words.2 WebGISTechnical PrinciplesAfter talking about a lot, we need to talk about the core implementation. Don't think that I am here. I really dedicate my experience and lessons to the students. My experience is as follows: (1) If a technology is too complex, it is not a good technology. For example, the prime energy equation E = mc * C is simple and elegant. Therefore, I think the law of the universe is a simple rule. Of course, most of us have not yet discovered it. (2) An implementation, if you want to write a lot of code, is still not a good implementation. For example, to boast the beauty of a person's length, say one thousand to 10 thousand, it is better to say 2 words: good-looking. Adhering to this principle, the following describes my technology: (1) the client (IE) uses ajax to directly call services on the server. (2) The server writes web services to respond to customer requests. That's all about the principles. Why don't I talk about it? If you don't know it, it means you still need to learn and learn.3. WebGISImplementationFirst, let's talk about the implementation of the server. As mentioned above, Web services are written ). It may not be more fashionable than writing Web Services. Some people say that Google Web APIs should replace the traditional WIN32API. In fact, there are two computing modes, and no one can replace them. Many experts like hype and apply the media set to our technical field to mislead consumers. In fact, if Web browsers are not popular, WebGIS is nothing. This society has never been fair, so we don't need to use C/S. We don't have to force us to do it in browsers. No way, let's do it. Let's see who made it? Web services can be written in many languages, such as C #, Java, and C ++. We need a set of things called WebGIS API. Design such an API for Ajax call. How to design it? I will publish my interface for your reference. In fact, the most important thing is the server's map generation engine (the engine is the engine ). I have implemented one (with VVT-I) by myself, or I have to buy a ready-made one (such as MapObjects ). It should be the client. Ajax is actually a javascript + XMLHttpRequest (Microsoft version) object. Let's just stop using WebServices. HTC. Although it was written by Microsoft, it's really hard to use. I copied one from Gao Ren. I changed it and used it. Look at my previous article. The source code is 100%. No error. The rest is redundant. Draw a system structure diagram: (how can an image not be displayed ??) WebGIS architecture Diagram4TipsIf you see this, do you think it is disgusting? Why are you prompted. It is not the "control" of the translation of "ATL technology insider" by Chinese experts from Peking University ". After reading it, it is awkward. The domestic name is "control", which is quite comfortable. The translation is far-fetched. (1) The server must request services using multiple threads (IIS processes. (2) The map engine must be able to load data in static and dynamic modes. (3) Never upload vector data. It is best to upload images, even if the network bandwidth will increase by 100 times in the future. (4) Write must be absolutely robust, otherwise it will paralyze IIS. (5) Remember to maintain the customer status on the server.5Appendix: interfaces and methods of WebGIS WebServicesMaybe they accidentally become standards? In fact, it is intended for readers to have a reference and a negative model when doing this design. I removed the data modification API, which is too dangerous. // WebGIS interface method description // August 2006 // ATL server WebGIS services created by cheungmine@gmail.com ////////////////////// /// // about mtkwebgisservice //// //////////////////////////////////////// //// // obtain service-related information hresultAbout([Out, retval] BSTR * info); // obtain the server Date and Time hresultSvrtime([Out, retval] mtktime * time ); //////////////////////////////////////// ////////////// log in and out, login must be the server method of 1st calls /////////////////////////////// /// // log on to the system, obtain the User Token and full graph URL. The hresult must be provided for any method call in the future.Login([In] BSTR username, [in] BSTR password); // log out of the system and log out the User Token hresultLogout(); //////////////////////////////////////// /// // Basic information ////////////////////// //// // current MTK canvas version hresultVersion([Out, retval] BSTR * ver); // retrieves information about all layers and returns hresult inline in XML.MapInfo([Out, retval] BSTR * xmlinfo); // Retrieves all layer information and returns the generated XML urlhresultMapxml([Out, retval] BSTR * xmlurl); // retrieves layer information and returns hresult inline with XMLLayinfo([In] Long layerindex, [out, retval] BSTR * xmlinfo); // retrieves graphic attribute information and returns it inline in XML. if the layer index is> = mtk_tmplayer_index, hresultShpinfo([In] Long layerindex, [in] Long fromshapeindex, [in] Long fetchcount, [out, retval] BSTR * xmlinfo); // retrieves graphic attribute information, returns the generated xml url. if the layer index is> = mtk_tmplayer_index, hresultShpxml([In] Long layerindex, [in] Long fromshapeindex, [in] Long fetchcount, [out, retval] BSTR * xmlurl ); //////////////////////////////////////// //////////// map browsing and point query /////////////////// /// // refresh the map, map imgurlhresultRefresh([Out] Double * scale, [out, retval] BSTR * imgurl); // map control display ratio hresultScale([Out] Double * minscale, [out] Double * maxscale); // display the map proportionally without changing the hresultZoom([In] Double scale); // specify the position of the view to zoom in or out the map, and specify the percentage of the zoom in or out. hresultZoomat([In] mtkpoint POs, [in] short percent); // open a window to display a map and specify two hresults on The View.Zoomext([In] mtkpoint pos1, [in] mtkpoint pos2); // open a window to display the map, specifying the 2-point hresult on the mapZoomext2([In] mtkpoint pt1, [in] mtkpoint pt2); // move the map to specify two hresults on The View.Move([In] mtkpoint frompos, [in] mtkpoint topos); // select a graphic object and specify a vertex in the view. Return the negative Sid value of the object and the layer index and Object Information hresult of the object.Identify([In] mtkpoint POs, [out] Long * _ SID, [out] Long * layid, [out, retval] BSTR * shpinfo); // set the layer state attribute, specifies the layer index and status name, And the status value hresultSetlayer([In] Long layerindex, [in] mtkenumlayerstate State, [in] bool bval); // locate the map hresult by centering on the points in the specified viewCenterat([In] mtkpoint POS); // uses the coordinate point of the specified map as the center to locate the map hresultCenterat2([In] mtkpoint pt); // map page turning, specifying the percentage of page overlap between up, down, right, left and page ~ 100% "hresultFlip([In] mtkenumflip direction, [in] short overlap); // clear the hresult of the selected object.Clear(); //////////////////////////////////////// ///////////// Map measurement, point string on the view /////////////////////////////////// /////////////////// map measurement, return distance, area, and map unit hresultMeasure([In] mtkpoints pathpoints, [out] Double * length, [out] Double * Area, [out] BSTR * Unit); // map measurement, return distance, area and map unit hresultMeasure2([In] BSTR pathstring, [out] Double * length, [out] Double * Area, [out] BSTR * Unit ); //////////////////////////////////////// //// // Coordinate Transformation: view and Data) between positive and negative coordinate transformations /////////////////////////////////// ////////////////// obtain the coordinate range of the current map data hresultExtent([Out] Double * Minx, [out] Double * miny, [out] Double * Maxx, [out] Double * Maxy); // converts a view point to a coordinate hresultVp2dp([In] Long VX, [in] Long Vy, [out] Double * dx, [out] Double * Dy); // The coordinate point of the data is converted to the hresult of the view.Dp2vp([In] Double dx, [in] Double dy, [out] Long * VX, [out] Long * Vy); // The View Point string is converted to the data coordinate string hresultVs2ds([In] BSTR vs, [out, retval] BSTR * DS); // converts the coordinate string of the data to the hresult of the view vertex string.Ds2vs([In] BSTR ds, [out, retval] BSTR * ); //////////////////////////////////////// //// // query and analyze the space //////////////////// /// // reset the filter. clear all previously set filters hresultResetfilters(); // Set the filter. You can call this method multiple times to set multiple filters. As long as the server supports multiple filters, the total number of filters returned is hresult.Addfilter([In] mtkfilter filter, [out, retval] Long * count); // searches for graphical objects based on conditions and returns the number of queried objects. the query result layer is a temporary layer, and the index is I + mtk_tmplayer_indexhresult.Findshapes([In] Long layerindex, [in] BSTR sqlclause, [in] bool usefilters, [out, retval] Long * count); // generates a buffer image and returns the SID of the target image. this operation is all in the tracking layer hresultBuffershape([In] Long Sid, [in] double distance, [out, retval] Long * siddst); // Save the graphic data in the non-trace layer to the trace layer, returns the image sidhresult.Trackshape([In] Long layerindex, [in] Long shapeindex, [out, retval] Long * Sid ); //////////////////////////////////////// ///////////// graphic editing ////////////////////// //// // create a new graphic object, returns the idhresult of the graphic object.Createshape([In] mtkenumgeometry gtype, [out, retval] Long * Sid); // Add a point in the view and a pixel coordinate hresult to the New Graph object.Addpt([In] Long Sid, [in] mtkpoint POS); // Add a vertex to the new graphic object, map coordinate hresultAddpt2([In] Long Sid, [in] mtkpoint pt); // Add a single attribute to the graphic object, indicating that the column index is 0-based, and the column value is hresultSetcol([In] Long Sid, [in] short colid, [in] BSTR colval); // clear the image of the specified Sid. the drawn images are saved in the tracking layer. SID = 0 Delete All hresultClearshape([In] Long Sid );