STEP 1. Create A DataStore
STEP 1.1
Start Geoserver and then open your running Geoserver start page. If it is run locally,
the address is http://localhost:8080/geoserver<- Try clicking it if you have Geoserver already running
To get to it, open up your favorite web browser and type in that address. It will take you to the Geoserver start page.
Now we need to navigate to the DataStore config section of Geoserver.
Click on the 'Config' button. If you are not already logged in, log yourself in with the default username and password (username: admin , password: geoserver).
Next, click on the 'Data' button.
Then, click on the 'Stores' button.
STEP 1.2
You need to tell Geoserver where the data is.
Select 'New' on the left purple-ish panel
STEP 1.3
Select 'DataStore Description' as 'Shapefile'
Also set DataStore ID to be your shapefile name, it can be whatever you want, not necessarily the file name.
For our example, enter mytutorial
When you are done, hit the 'New' button.
STEP 1.4
Now we need to specify the shapefile we want to use. To locate the
shapefile we need to specify where it lives relative to the data
directory (data_dir/). The data directory lives right under the root
location of GeoServer. For example:
C:\Java\Geoserver\data_dir
In the data directory, there is a sub directory called data/
(C:\Java\Geoserver\data_dir\data). Place your shapefile in that
directory.
In the URL field, enter the location of the file. For example:
All URLs you will use are relative to the data directory (data_dir/).
If you do not want to copy your full shapefile into GeoServer, there
are other ways to refer to it, see the full Shapefile DataStore section of the docs.
Hit the 'Submit' button.
Now, we need to register all the changes. To do that, hit the 'Apply' button on the left, then 'Save' if you want to save it out for future use.
STEP 2. Create The FeatureType
STEP 2.1
Now, back up a spot in Geoserver Config and go to Config -> Data -> FeatureType
Hit 'New'
From the drop down list, Feature Type Name, select your datastore.
Then Hit 'New'
STEP 2.2
Select your DataStore: test_datastore:::tutorial
Then hit the 'New' button.
STEP 2.3
A new screen will appear that looks a little confusing, but you can
ignore most of it. One thing you have to enter is the SRS value. If you
don't know what SRS is and you just want to see your stuff, then enter 4326.
|
|
Definitions
SRS (Spatial Reference System):
The SRS value describes what projection the data is in. It is represented by a number that uniquely identifies each projection.
|
|
Hit the 'Generate' button, this will get your bounding box and display your projection information in a faded grey color.
STEP 2.4
Now you have to add a style for the data. The style defines how the data will be drawn (color, line thickness etc..).
You can use one of the pre-cooked styles in the "Style" drop down list or create your own using the "Create New SLD" button.
If you select to use an existing style, make sure it can render your
type of geometry. If you have points, use a style that can render
points (for example the "point" SLD). For lines use a line style, for
polygons use a polygon style. There are three default styles for you to
use: point, line, polygon.
If you opt to create a new SLD with the SLD Wizard, it is pretty
easy. It knows what geometries your data uses and will display the
appropriate fields you need to style your data.
All you have to do in fill in the appropriate colors, either by hand or
by clicking on the little multi-colored box next to the color field.
This is the color picker. When you are done configuring your style, hit
the Apply Style button. Then hit the Finished button.
(There is a known bug that will cause the style not to be applied if
the feature type you just created hasn't been saved, this will be fixed
in the next release).
STEP 2.5
Hit the 'submit' button. The window will change again and take you back to the FeatureType screen.
STEP 2.6
- Once again, hit the 'Apply' and then 'Save' buttons.
STEP 3. Try It Out
STEP 3.1
You can try out the WFS with this URL (change the typename from tutorial to your featureType name):
http://localhost:8080/geoserver/wfs?request=getfeature&service=wfs&version=1.0.0&typename=tutorial
You should get back a bunch of XML (GML), and it should look
confusing, but you can probably make out the attributes of your file.
STEP 3.2
You can also view the data in Google Earth (sweet!). If you have Google
Earth installed, all you have to do is open up a web browser and enter
this URL (changing myFeatureType to match your FeatureType name):
http://localhost:8080/geoserver/wms/kml_reflect?layers=myFeatureType
STEP 3.3
You can try out the WMS, instantly viewing your new layer with the MabBuilder based preview:
http://localhost:8080/geoserver/mapPreview.do
Just find the layer you added, and you'll get a nice zoomable map of
the extent. For a more advanced view you'll actually have to dig into http://mapbuilder.sourceforge.net, or check out the Clients section for other options, both desktop and web-based]
分享到:
相关推荐
3. **配置数据源**:在数据源创建页面,选择“Shapefile”作为数据存储类型,填写工作空间、数据源名称,并指定SHP文件的路径。确认设置无误后,点击“保存并测试连接”,确保GeoServer能正确读取数据。 4. **发布...
在GeoServer中,Shapefile作为数据源之一被广泛使用。用户可以通过以下步骤将其导入GeoServer: 1. 准备Shapefile文件集,确保包括`.prj`、`.dbf`、`.shx`和`.shp`文件。 2. 登录到GeoServer管理界面,选择“工作区...
总结来说,GeoServer安装配置后,可以发布WMS服务,这涉及到在UDig中对shp文件进行符号化并生成SLD文件。需要编辑SLD文件以适配正确的字符集,然后在GeoServer中创建工作区、数据存储、图层,并应用SLD样式。最终,...
调用`viewer.dataSources.add(geoJsonDataSource)`将数据源添加到Viewer中。这会自动将GeoJSON几何体转换为Cesium的Entity对象,并在3D场景中显示。 5. **样式设置**:你可以通过`GeoJsonDataSource`的事件监听器或...
例如,对于Shapefile,需要上传.shp文件及其关联文件到GeoServer,系统会自动识别并创建数据源。 **三、图层发布** 数据源添加完成后,可以创建图层。图层是数据的可视化表示,可以在管理界面中选择“图层” -> ...
- **添加数据存储**:使用`createDataStore`方法,指定工作空间、数据源路径、数据类型等信息。 - **发布图层**:调用`storeLayer`,指定数据存储、图层名、坐标参考系等参数。 - **设置图层风格**:使用`...
在GeoServer中,GML可以作为数据源,也可以作为数据输出格式,提供WFS服务。 5. **GeoServer的数据发布流程**:首先,我们需要将这些数据加载到GeoServer中,通过管理界面选择数据目录,然后配置工作空间、数据存储...
5. **配置数据源**:在“数据” -> “数据库”下,选择“新建”来添加新的数据源。数据描述可以根据实际数据内容命名,如“中国地图”。Feature 数据集 ID 是自定义的,比如“ding”。接着,提供数据的路径,通常是...
- **配置数据**: 在管理界面中,点击“工作空间”、“数据存储”来添加新的数据源。上传你的SHP文件,Geoserver会自动识别并创建对应的图层。 **OpenLayers配置** 1. 创建HTML页面,引入OpenLayers库的JavaScript...
1. **发布数据**:可以将`.shp`(Shapefile)和`.tif`(GeoTIFF)等栅格或矢量数据文件快速发布到GeoServer。Shapefile是常见的矢量数据格式,包含地理特征如点、线、面等;GeoTIFF则是一种带有地理坐标系统的栅格...
此外,shp数据可以与其他数据源结合,例如人口密度、商业分布等,进行更深入的空间分析,为城市规划、交通管理和政策制定提供依据。通过GIS技术,这些数据可以转化为直观的信息图层,支持决策者做出基于地理信息的...
- **新建数据集**:上传地理空间数据文件,例如SHP(Shapefile)格式,创建一个新的数据源。 - **新建Feature Type**:选择数据集中的一个或多个表,定义为Feature Type,用于地图展示。 - **应用保存配置**:...
接着在“覆盖”中上传SHP文件,设置相应的元数据和权限。 **OpenLayers集成** 1. **创建HTML页面**:新建一个HTML文件,引入OpenLayers库的JavaScript文件。 2. **设置视图**:定义地图的基本视图,包括中心位置、...
- **配置uDig地图**:创建新的项目和地图,通过"Files"添加SHP文件,如果是`geoserver`中的数据源,则选择"Web Feature Server"。输入`geoserver`的WMS URL获取数据,将所需图层添加到地图中。 - **设置样式**:在...
OpenLayers是一个JavaScript库,用于在Web浏览器中显示地图,而GeoServer则是一个基于Java的服务,它允许用户发布、管理和操作地理空间数据。本资源主要针对初级学习者,介绍如何使用OpenLayers对GeoServer图层进行...
- 在GeoServer的web界面中,可以通过管理员账号(admin)和密码(geoserver)登录,进行地图服务的配置,包括数据源的添加、服务类型的设置等。 #### 二、地图数据处理与发布 **地图数据转为SHP数据格式:** - ...
在弹出的界面中,输入数据源名称(例如`shape`),并指定shp文件所在的目录路径。 4. **发布图层** 完成数据存储配置后,选中该数据存储,点击“发布”按钮。在弹出的界面中,选择合适的坐标参考系统(CRS),...
- **设置地图源**:连接到Geoserver,指定公开的WMS服务端点作为地图源。 - **添加图层**:根据需要,从Geoserver中选择要显示的图层并添加到地图上。 - **交互功能**:利用OpenLayers的API实现缩放、平移、图层...