import java.awt.Point;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import javax.xml.parsers.ParserConfigurationException;
import org.alternativevision.gpx.GPXParser;
import org.alternativevision.gpx.beans.GPX;
import org.alternativevision.gpx.beans.Track;
import org.alternativevision.gpx.beans.Waypoint;
import org.xml.sax.SAXException;
public class PointParser {
private static Double latitude;
private static Double longitude;
private static Double elevation;
private static Date time;
public static void main (String[] args) throws ParserConfigurationException, SAXException, IOException{
FileInputStream input = new FileInputStream("E:\\sample.gpx");
GPXParser parser = new GPXParser();
GPX gpx = parser.parseGPX(input);
Track trk = new Track();
ArrayList<Waypoint> trkpt = trk.getTrackPoints();
Object[] pointArray = trkpt.toArray();
for (Object o : pointArray){
Point p = (Point) o;
}
Waypoint wp = new Waypoint();
latitude = wp.getLatitude();
longitude = wp.getLongitude();
elevation = wp.getElevation();
time = wp.getTime();
}
public static Double getLatitude() {
return latitude;
}
public static void setLatitude(Double latitude) {
PointParser.latitude = latitude;
}
public static Double getLongitude() {
return longitude;
}
public static void setLongitude(Double longitude) {
PointParser.longitude = longitude;
}
public static Double getElevation() {
return elevation;
}
public static void setElevation(Double elevation) {
PointParser.elevation = elevation;
}
public static Date getTime() {
return time;
}
public static void setTime(Date time) {
PointParser.time = time;
}
}
&#13;
您好, 我是java和GPXparser库的新手。我有一个包含一些跟踪点的GPX文件。我想从这个文件中提取经度,纬度,时间和高程的4个元素,并在我的java代码中的另一个类的算法中使用它。当我运行它时,我看到了这个错误:
&#34;在PointParser.main(PointParser.java:23) 引起:java.lang.ClassNotFoundException:org.apache.log4j.Logger&#34;
任何人都可以帮我吗?我使用的是GPXparser correclty吗?!
提前谢谢