shapefile.rst 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. .. _data_shapefile:
  2. Shapefile
  3. =========
  4. shapefile 是一种流行的地理空间矢量数据格式。
  5. .. note:: 虽然GeoServer对shapefile格式提供了强大的支持,但在生产环境中不建议选择该格式。诸如PostGIS之类的数据库更适合生产,并提供更好的性能和可伸缩性。有关更多信息,请参见 :ref:`production` 部分.
  6. 添加 shapefile
  7. ------------------
  8. Shape文件实际上是文件的集合 (扩展名: ``.shp``, ``.dbf``, ``.shx``, ``.prj``, 或其他). 。所有这些文件都必须存在于同一目录中,以便GeoServer准确读取它们。与所有格式一样,将shapefile添加到GeoServer涉及通过 ref:`web_admin`将新存储添加到现有 ref:`data_webadmin_stores`。
  9. .. warning:: ``.prj`` 尽管不是必需文件, ,但在与GeoServer一起使用时,强烈建议使用该文件,因为它包含有价值的投影信息。没有它,GeoServer可能无法加载您的shapefile!
  10. 首先,导航至:`存储 --> 添加新存储 --> Shapefile`.
  11. .. figure:: images/shapefile.png
  12. :align: center
  13. *添加shapefile作为存储*
  14. .. list-table::
  15. :widths: 20 80
  16. * - **选项**
  17. - **描述**
  18. * - :guilabel:`Workspace`
  19. - 包含存储的工作空间的名称。这也将是从存储创建的图层的前缀。
  20. * - :guilabel:`Data Source Name`
  21. - GeoServer已知的shapefile的名称。可以与文件名不同。工作空间名称和该名称的组合将是完整的图层名称 (例如: topp:states).
  22. * - :guilabel:`Description`
  23. - shapefile /存储的描述。
  24. * - :guilabel:`Enabled`
  25. - 启用存储。如果未选中,则不会提供shapefile中的任何数据。
  26. * - :guilabel:`URL`
  27. - shapefile的位置。可以是绝对路径(例如 :file:`file:C:\\Data\\shapefile.shp`) 或相对于数据目录的路径(例如 :file:`file:data/shapefile.shp`.
  28. * - :guilabel:`namespace`
  29. - 与shapefile关联的命名空间。通过更改工作区名称来更改此字段。
  30. * - :guilabel:`create spatial index`
  31. - 启用自动创建空间索引的功能。
  32. * - :guilabel:`charset`
  33. - 用于从 ``.dbf`` 文件解码字符串的字符集。
  34. * - :guilabel:`memory mapped buffer`
  35. :guilabel:`Cache and reuse memory maps`
  36. - 启用使用内存映射的I / O,从而改善了文件在内存中的缓存。 **关闭Windows服务器**.
  37. 完成后,点击 :guilabel:`Save`.
  38. 配置shapefile图层
  39. -----------------------------
  40. Shapefile恰好包含一层,需要先将其添加为新层,然后才能由GeoServer提供服务。有关如何添加和编辑新图层,请参见 :ref:`data_webadmin_layers` 。