---
# System prepended metadata

title: 1.arcGIS- KML import as query Service操作流程
tags: [db, arcgis]

---

# 1.arcGIS- KML import as query Service操作流程

###### tags: `arcgis`,`db`

1. import initial .kml


:::info
Catalog-> kml to layer
![](https://i.imgur.com/3UvsXsM.png)
:::

2. import this KML to DB

:::info
Catalog-> database Connections -> select connected DB -> Import -> Feature Class(single)
![](https://i.imgur.com/BlvNw5j.png)
:::

:::info
拖曳layer到 input features -> 匯入Layer到db table
output feature class 匯入後table名稱
![](https://i.imgur.com/0KEhFOD.png)
:::

3. db modify schema

:::info
修改schema 新增自訂欄位
![](https://i.imgur.com/gaZbH9j.png)
![](https://i.imgur.com/O6q2zOG.png)
:::


4. import db table as layer 

```sql=
SELECT *
  FROM [arcgis_demo].[dbo].[SHILIN_TABLE]
  --alter table shilin_table add city varchar(15), county varchar(15);
  update shilin_table set city= SUBSTRING(name,1,3);
  update shilin_table set county= SUBSTRING(name,4,6);
```

:::info
拖曳db table 到 arcMap為layer
![](https://i.imgur.com/Ss9W9x4.png)

檢驗layer包含自訂資料
![](https://i.imgur.com/HHJUZ5J.png)

:::

5. 發布service

:::info
![](https://i.imgur.com/k4CwJug.png)
![](https://i.imgur.com/Xaueij2.png)
![](https://i.imgur.com/mVBYjjq.png)

選擇服務所在資料夾
![](https://i.imgur.com/6hrmfS9.png)

analyze無error
![](https://i.imgur.com/khk2Rp7.png)

publish
![](https://i.imgur.com/XaTOw8X.png)

:::

6. 查詢service運行

:::info
範例位置: https://210.68.105.171:6443/arcgis/rest/services/Ctop/
![](https://i.imgur.com/EFh8bOs.png)

確認有對應custom column
![](https://i.imgur.com/xq8YxDt.jpg)
:::
