是否可以根据URL在arcgis层中编写动态SQL查询?

问题描述 投票:0回答:1

我有一个arcgis层,例如https://baseURL/myMapServer/0我想根据输入参数为此层定义一个查询。例如:

select * from my_table where category = ::category

并且将类别作为URL参数传递,例如:

https://baseURL/myMapServer/0?category=cat1

我该怎么做?

注意:

我尝试过:

https://baseURL/myMapServer/0/query=category=cat1

并将我的查询定义为:

select * from my_table where category = ::category

但是arcgis说抱怨:: category的查询语法是错误的。

arcgis
1个回答
0
投票

似乎您可以发布具有以下定义的查询层的地图服务器:

select * from my_table

然后,您将通过以下URL使用REST服务过滤类别:

https://baseURL/myMapServer/0/query?category='cat1'

注意cat1可能区分大小写。然后,您应该检查数据库中的值是cat1还是CAT1或Cat1。在Oracle中使用地理数据库会发生这种情况。

还要注意,引号('cat1')很重要。您应该对它们进行urlencode。另外,使用问号将参数传递给'query'方法。

© www.soinside.com 2019 - 2024. All rights reserved.