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



This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
 給定人員gps位置後,需要知道人員的所在道路或建築物的名稱 
Author Message
中级会员
User avatar

Joined: 2013-01-27 0:46
Posts: 447
Post 給定人員gps位置後,需要知道人員的所在道路或建築物的名稱
我們急需要一個功能,就是給定人員gps位置後,需要知道人員的所在道路或建築物的名稱。
我使用WFS來查詢總是失敗,不知道哪地方有錯?

public void findGeoInfoByGpsLocation() {
double longitude = 114.04767; <===給定真實廠區內的位置
double latitude = 22.65905; <===給定真實廠區內的位置
GeoCoordinate coordinate = new GeoCoordinate(longitude, latitude);
SpatialOperateCondition condition = new SpatialOperateCondition(TWaverGisConst.GML_TYPE_POINT);
condition.setOperatorType(TWaverGisConst.SPATIAL_OPERATOR_TYPE_CONTAIN);
condition.setCoordinates(new GeoCoordinate[] {coordinate});
String wfsUrl = "http://" + WMS_SERVER_IP + ":" + WMS_SERVER_PORT + "/geoserver/wfs?";
String layerName = "osm_lh:planet_osm_line"; <=====找不到會切換到其他圖面來查
GeographyFeature[] features = WFSRequest.requireFeatures(wfsUrl.toString(),
WFSUtils.buildSpatialOperation(layerName, new String[] {}, condition));
if (features != null) {
for (int i = 0; i < features.length; i++) {
Iterator iterator = ((GeographyFeature) features[i]).getAttributesNames();
while (iterator.hasNext()) {
String name = iterator.next().toString();
System.out.println(name + " --- " + features[i].getAttribute(name));
}
}
} else {
System.err.println("找不到");
}
}

總是回:

get error response:
ows:ExceptionReport xmlns:ows="http://www.opengis.net/ows" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/ows http://127.0.0.1:8090/geoserver/schemas ... Report.xsd">
<ows:Exception exceptionCode="InvalidParameterValue">
<ows:ExceptionText>Illegal property name: the_geom</ows:ExceptionText>
</ows:Exception>
</ows:ExceptionReport>


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

Joined: 2013-01-27 0:46
Posts: 447
Post Re: 給定人員gps位置後,需要知道人員的所在道路或建築物的名稱
改寫:

public void searchGeoInfoByGpsCoordinate() {
double longitude = 114.04767;
double latitude = 22.65905;

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

// GeoCoordinate coordinate = GisToolkits.convertScreenToLatLong(map, new java.awt.geom.Point2D.Double(x, y));
GeoCoordinate coordinate = new GeoCoordinate(longitude, latitude);
SpatialOperateCondition condition = new SpatialOperateCondition(TWaverGisConst.GML_TYPE_POINT);
condition.setOperatorType(TWaverGisConst.SPATIAL_OPERATOR_TYPE_CONTAIN);
condition.setCoordinates(new GeoCoordinate[] {coordinate});

layers = WFSUtils.getWFSLayers(TWaverGisConst.EXECUTOR_TYPE_GEOSERVER, wfsServer);
Iterator itearator = layers.iterator(); //get all publiched layers.
while (itearator.hasNext()) { //查詢每一個layer
WMSLayerInfo info = (WMSLayerInfo) itearator.next();
System.err.println(info.getLayerName());
layerName = info.getLayerName();
GeographyFeature[] features = WFSRequest.requireFeatures(wfsServer.toString(),
WFSUtils.buildSpatialOperation(layerName, new String[] {}, condition));
if (features != null) {
for (int i = 0; i < features.length; i++) {
Iterator iterator = ((GeographyFeature) features[i]).getAttributesNames();
while (iterator.hasNext()) {
String name = iterator.next().toString();
System.out.println(name + " --- " + features[i].getAttribute(name));
}
}
}
}
System.err.println("找不到");
}
=============== Return =====================
osm_lh:planet_osm_line
get error response:
ows:ExceptionReport xmlns:ows="http://www.opengis.net/ows" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/ows http://127.0.0.1:8090/geoserver/schemas ... Report.xsd">
<ows:Exception exceptionCode="InvalidParameterValue">
<ows:ExceptionText>Illegal property name: the_geom</ows:ExceptionText>
</ows:Exception>
</ows:ExceptionReport>
osm_taiwan:planet_osm_line
get error response:[2014/01/16 15:41:59:966] (TRACE) JVrsAp.GL.usr.UserManager.postGps(UserManager.java:71)

ows:ExceptionReport xmlns:ows="http://www.opengis.net/ows" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/ows http://127.0.0.1:8090/geoserver/schemas ... Report.xsd">
<ows:Exception exceptionCode="InvalidParameterValue">
<ows:ExceptionText>Illegal property name: the_geom</ows:ExceptionText>
</ows:Exception>
</ows:ExceptionReport>
osm_tj:planet_osm_line
get error response:
ows:ExceptionReport xmlns:ows="http://www.opengis.net/ows" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/ows http://127.0.0.1:8090/geoserver/schemas ... Report.xsd">
<ows:Exception exceptionCode="InvalidParameterValue">
<ows:ExceptionText>Illegal property name: the_geom</ows:ExceptionText>
</ows:Exception>
</ows:ExceptionReport>
osm_lh:planet_osm_polygon
get error response:
ows:ExceptionReport xmlns:ows="http://www.opengis.net/ows" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/ows http://127.0.0.1:8090/geoserver/schemas ... Report.xsd">
<ows:Exception exceptionCode="InvalidParameterValue">
<ows:ExceptionText>Illegal property name: the_geom</ows:ExceptionText>
</ows:Exception>
</ows:ExceptionReport>
osm_taiwan:planet_osm_polygon
get error response:
ows:ExceptionReport xmlns:ows="http://www.opengis.net/ows" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/ows http://127.0.0.1:8090/geoserver/schemas ... Report.xsd">
<ows:Exception exceptionCode="InvalidParameterValue">
<ows:ExceptionText>Illegal property name: the_geom</ows:ExceptionText>
</ows:Exception>
</ows:ExceptionReport>
osm_tj:planet_osm_polygon
get error response:
ows:ExceptionReport xmlns:ows="http://www.opengis.net/ows" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/ows http://127.0.0.1:8090/geoserver/schemas ... Report.xsd">
<ows:Exception exceptionCode="InvalidParameterValue">
<ows:ExceptionText>Illegal property name: the_geom</ows:ExceptionText>
</ows:Exception>
</ows:ExceptionReport>
osm_lh:planet_osm_roads
get error response:
ows:ExceptionReport xmlns:ows="http://www.opengis.net/ows" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/ows http://127.0.0.1:8090/geoserver/schemas ... Report.xsd">
<ows:Exception exceptionCode="InvalidParameterValue">
<ows:ExceptionText>Illegal property name: the_geom</ows:ExceptionText>
</ows:Exception>
</ows:ExceptionReport>
osm_taiwan:planet_osm_roads
get error response:
ows:ExceptionReport xmlns:ows="http://www.opengis.net/ows" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/ows http://127.0.0.1:8090/geoserver/schemas ... Report.xsd">
<ows:Exception exceptionCode="InvalidParameterValue">
<ows:ExceptionText>Illegal property name: the_geom</ows:ExceptionText>
</ows:Exception>
</ows:ExceptionReport>
osm_tj:planet_osm_roads
get error response:
ows:ExceptionReport xmlns:ows="http://www.opengis.net/ows" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/ows http://127.0.0.1:8090/geoserver/schemas ... Report.xsd">
<ows:Exception exceptionCode="InvalidParameterValue">
<ows:ExceptionText>Illegal property name: the_geom</ows:ExceptionText>
</ows:Exception>
</ows:ExceptionReport>
找不到


2014-01-16 15:37
Profile
Display posts from previous:  Sort by  
This topic is locked, you cannot edit posts or make further replies.   [ 2 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: