一、使用

  1. <body>
  2. <input type="text" id="fid">
  3. <button onclick="queryByFID()">fid查询</button>
  4. <div id="map_container">
  5. </div>
  6. <script>
  7. var docLayer = new Zondy.Map.Doc('', 'city', {
  8. ip: 'localhost',
  9. port: 6163
  10. })
  11. var map = new ol.Map({
  12. target: "map_container",
  13. layers: [gaodeMapLayer, docLayer],
  14. view: new ol.View({
  15. projection: 'EPSG:4326',
  16. center: [114.30, 30.50],
  17. zoom: 4
  18. })
  19. })
  20. function queryByFID() {
  21. var fid = document.getElementById("fid").value;
  22. console.log(fid)
  23. /* 1、设置查询结构 */
  24. const queryStruct = new Zondy.Service.QueryFeatureStruct();
  25. queryStruct.IncludeGeometry = true;
  26. queryStruct.IncludeWebGraphic = true
  27. /* 2、设置查询参数 */
  28. const queryParam = new Zondy.Service.QueryParameter({
  29. struct:queryStruct,
  30. objectIds:fid
  31. })
  32. /* 3、调用查询服务 */
  33. const queryService = new Zondy.Service.QueryDocFeature(
  34. queryParam,
  35. 'city',
  36. 0,{
  37. ip:'localhost',
  38. port:6163
  39. }
  40. )
  41. /* 4、回到 */
  42. queryService.query(querySuccess)
  43. }
  44. function querySuccess(result){
  45. var format = new Zondy.Format.PolygonJSON();
  46. var features = format.read(result);
  47. console.log(features);
  48. }
  49. </script>
  50. </body>
  51. </html>