Use GeoServer to export map data Geojson and apply

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.