In the project, need to use the map border of Township streets, previously used is Baidu map or echarts map, which does not have this part of the administrative region of data, need to purchase data in third parties, which provides SHP files
Main file: counties.shp
Index file: counties.shx
dBASE Table: OUNTIES.DBF
I use GeoServer to import SHP files (select GBK encoding when importing files), and then export data to Geojson format using GeoServer interface management
Start to use the GeoServer2.3.8, when the export asked KML data, Chinese did not appear garbled phenomenon, but exported to Geojson, there is garbled phenomenon, there is no search on the Internet solution.
Find the Chinese garbled problem, find a half-day, did not find, re-download GeoServer2.8.0 version, no other processing to solve the garbled problem.
Note: GeoServer has requirements for the JDK and should look at its documentation when downloading the corresponding version.
I used COUNTY.SHP to do a demo.
SHP file (the second file is automatically generated when you import GeoServer)
After importing, the GeoServer management interface is as follows:
Select the Geojson in the right down, will open a JSON file in the Web page, save to Local
The map format used by Echarts is Geojson
Openlayers Display Effect:
Use the Geojson file to display in Echarts
On the Baidu map to show the effect:
Export some administrative names on the console:
Note: In Echarts, the encoding used is UTF-8, the exported Geojson file, the properties of features have no attribute name, and when using the Echarts function, the Name property that needs to be used,
Modify the Geojson in the corresponding attribute name to name, the following picture is I import provincial map, modified, to some provinces using echarts for coloring effect.
Use GeoServer to export map data Geojson and apply