TWaver Forums
http://servasoft.com/forum/

給定人員gps位置後,需要知道人員的所在道路或建築物的名稱
http://servasoft.com/forum/viewtopic.php?f=16&t=4697
Page 1 of 1

Author:  tai [ 2014-01-16 11:25 ]
Post subject:  給定人員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>

Author:  tai [ 2014-01-16 15:37 ]
Post subject:  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>
找不到

Page 1 of 1 All times are UTC + 8 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/