View unanswered posts | View active topics It is currently 2018-08-20 9:21



This topic is locked, you cannot edit posts or make further replies.  [ 8 posts ] 
 GIS 圖面Polygon or Road 搜尋 
Author Message
中级会员
User avatar

Joined: 2013-01-27 0:46
Posts: 447
Post GIS 圖面Polygon or Road 搜尋
Dear All,

我發現只能搜尋英文(區分大小寫)與數字,中文(繁體與簡體)則都不行 !!!!
真的是這樣嗎?? :e..:

Code:
    public void searchKeyWordsOnMap(String keyWord) {
        String wfsServer = "http://" + WMS_SERVER_IP + ":" + WMS_SERVER_PORT + "/geoserver/wfs?";
        ComparisonOperateCondition condition = new ComparisonOperateCondition(TWaverGisConst.
                COMPARISON_QUERY_BY_SINGLEOPERATOR);
        condition.setReferenceProperties(new String[] {"name"});
        condition.setReferenceValues(new String[] {keyWord});
        condition.setOperators(new int[] {TWaverGisConst.COMPARISON_OPERATOR_LIKE});
        String layerName = "osm_lh:planet_osm_polygon";
        String reuqires = WFSUtils.buildComparisonOperation(layerName, new String[] {}, condition);
        GeographyFeature[] features = WFSRequest.requireFeatures(wfsServer, reuqires);
        if (features != null) {
            addShapeNodes(features, network);
        } else {
            layerName = "osm_lh:planet_osm_roads";
            reuqires = WFSUtils.buildComparisonOperation(layerName, new String[] {}, condition);
            features = WFSRequest.requireFeatures(wfsServer, reuqires);
            if (features != null) {
                addShapeNodes(features, network);
            } else {
                layerName = "osm_lh:planet_osm_line";
                reuqires = WFSUtils.buildComparisonOperation(layerName, new String[] {}, condition);
                features = WFSRequest.requireFeatures(wfsServer, reuqires);
                if (features != null) {
                    addShapeNodes(features, network);
                } else {
                    JOptionPane.showMessageDialog(fatherFrame, "找不到相關資訊!!");
                }
            }
        }
    }


2014-01-15 18:33
Profile
白金会员

Joined: 2013-05-20 10:09
Posts: 1045
Post Re: GIS 圖面Polygon or Road 搜尋
tai wrote:
我發現只能搜尋英文(區分大小寫)與數字,中文(繁體與簡體)則都不行 !!!!

我们传送过去的查询条件都是编码过的UTF-8形式。可能有两个原因,一是你的空间数据库是否支持中文(中文是否会乱码),二可能是geoserver对中文的支持可能不够好。


2014-01-16 10:04
Profile
中级会员
User avatar

Joined: 2013-01-27 0:46
Posts: 447
Post Re: GIS 圖面Polygon or Road 搜尋
jack wrote:
tai wrote:
我發現只能搜尋英文(區分大小寫)與數字,中文(繁體與簡體)則都不行 !!!!

我们传送过去的查询条件都是编码过的UTF-8形式。可能有两个原因,一是你的空间数据库是否支持中文(中文是否会乱码),二可能是geoserver对中文的支持可能不够好。


可以顯示中文(繁簡都可以),空间数据库(postgres)支持中文(繁簡都可以)
我發現查不到line or roads上的字(中英文都不行)

所以目前只有英文(polygon上)才查的到。


2014-01-16 11:14
Profile
中级会员
User avatar

Joined: 2013-01-27 0:46
Posts: 447
Post Re: GIS 圖面Polygon or Road 搜尋
理論上WMS是geoserver向postgres資料庫取得相關資料後的呈現
所以postgres資料庫應該是有這些資料才對!!
意思是圖面上看的到的文字,postgres資料庫應該是有的。
Geoserver也是支持UTF-8
postgres資料庫我直接看內容也是有中文...

還是您有建議的GIS server可以用??


2014-01-16 11:32
Profile
中级会员
User avatar

Joined: 2013-01-27 0:46
Posts: 447
Post Re: GIS 圖面Polygon or Road 搜尋
請問這些的差異???

public static final int COMPARISON_QUERY_BY_FID = 0;
public static final int COMPARISON_QUERY_BY_SINGLEOPERATOR = 1; <====目前用這個!!
public static final int COMPARISON_LOGIC_TYPE_MULTIOPERATORS_AND = 2;
public static final int COMPARISON_LOGIC_TYPE_MULTIOPERATORS_OR = 3;
public static final int COMPARISON_LOGIC_TYPE_MULTIOPERATORS_NOT = 4;


2014-01-16 13:59
Profile
中级会员
User avatar

Joined: 2013-01-27 0:46
Posts: 447
Post Re: GIS 圖面Polygon or Road 搜尋
做了些修改!!

public void searchKeyWordsOnMap(String keyWord) {
List layers = new ArrayList();
String layerName = null;
String wfsServer = "http://" + WMS_SERVER_IP + ":" + WMS_SERVER_PORT + "/geoserver/wfs?";

ComparisonOperateCondition condition = new ComparisonOperateCondition(TWaverGisConst.
COMPARISON_QUERY_BY_SINGLEOPERATOR);
condition.setReferenceProperties(new String[] {"name"});
condition.setReferenceValues(new String[] {keyWord});
condition.setOperators(new int[] {TWaverGisConst.COMPARISON_OPERATOR_LIKE});

layers = WFSUtils.getWFSLayers(TWaverGisConst.EXECUTOR_TYPE_GEOSERVER, wfsServer);
Iterator itearator = layers.iterator(); //get all publiched layers.
while (itearator.hasNext()) {
WMSLayerInfo info = (WMSLayerInfo) itearator.next();
System.err.println(info.getLayerName());
layerName = info.getLayerName();
String reuqires = WFSUtils.buildComparisonOperation(layerName, new String[] {}, condition);
GeographyFeature[] features = WFSRequest.requireFeatures(wfsServer, reuqires);
if (features != null) {
addShapeNodes(features, network);
return;
}
}
JOptionPane.showMessageDialog(fatherFrame, "找不到相關資訊!!");
}

會找所有layer....
中文就是找不到!!!!!


2014-01-16 15:19
Profile
中级会员
User avatar

Joined: 2013-01-27 0:46
Posts: 447
Post Re: GIS 圖面Polygon or Road 搜尋
我使用WFS來查詢中文字時,總是查不到!! 英文可以查到!!
不知道是甚麼問題??

======查詢中文=========
<wfs:GetFeature service="WFS" version="1.1.0"
outputFormat="JSON"
xmlns:topp="http://www.openplans.org/topp"
xmlns:wfs="http://www.opengis.net/wfs"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:gml="http://www.opengis.net/gml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">
<wfs:Query typeName="osm_lh:planet_osm_polygon">
<ogc:Filter>
<ogc:PropertyIsLike wildCard="*" singleChar="#" escapeChar="!">
<ogc:PropertyName>name</ogc:PropertyName>
<ogc:Literal>*停車場*</ogc:Literal>
</ogc:PropertyIsLike>
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>

返回:
{"type":"FeatureCollection","totalFeatures":0,"features":[]}


GeoServer的日志:
Request: getFeature
service = WFS
version = 1.1.0
baseUrl = http://127.0.0.1:8090/geoserver/
query[0]:
filter = [ name is like *??????* ]
typeName[0] = {osm_lh}planet_osm_polygon
outputFormat = JSON
resultType = results
2014-01-27 13:01:00,232 INFO [wfs.json] - about to encode JSON


2014-01-27 13:47
Profile
新手上路

Joined: 2014-11-05 14:11
Posts: 1
Post Re: GIS 圖面Polygon or Road 搜尋
xyfifa is an established to provides all kinds of FIFA products, such as fifa 15 coins. FIFA 15 Coins,just take a look here buy fifa 15 coins,you will take fancy with this site all along. Welcome to buy FIFA Coins in our store through following: http://www.xyfifa.com/


2014-11-05 14:14
Profile
Display posts from previous:  Sort by  
This topic is locked, you cannot edit posts or make further replies.   [ 8 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: