开发者

Cant get Maps featureFeed to work

I am having a real issue retrieving map features from the features feed through the new java api on Android. Although i can get a featrureFeed containing an id and title (from a specific MapFeed), as soon as i add in FeatureContent to the request (for getting the placemark details) FeatureFeed.executeGet() returns with a '400 bad request' error. Am i doing something wrong, or is there actually an error with this at the moment? Below is some of my code - any information would be greatly appreciated as i've been banging my head against this for 3 days! (i've tried "kml:placemark", "atom:placemark" and "placemark" in the FeatureContent class)


public class FeatureFeed { 
    @Key("atom:id") 
    public String id; 
    @Key("atom:title") 
    public String title; 
    @Key("atom:entry") 
    public List features; 

public List<FeatureEntry> maps = new ArrayList<FeatureEntry>();

public static FeatureFeed executeGet( HttpTransport transport,
                BuildMapsUrl url) throws IOException {
 url.fields = GData.getFieldsFor(FeatureFeed.class);
 AtomParser parser = new AtomParser();
 parser.namespaceDictionary = Namespace.FEED_NAMESPACE_DICTIONARY;
 transport.addParser(parser);
 HttpRequest request = transport.buildGetRequest();
 request.url = url;
 return (FeatureFeed) RedirectHandler.
                  execute(request).parseAs(FeatureFeed.class);
}

}

public class FeatureEntry implements Cloneable { @Key("atom:id") public String id; @Key("atom:title") public String title; @Key("atom:content") public FeatureContent co开发者_StackOverflowntent;

public FeatureEntry() { // required } public FeatureEntry(String title, FeatureContent content) { this.title = title; this.content = content; } }

public class FeatureContent implements Cloneable {

@Key("@type") public String contentType = "application/vnd.google-earth.kml+xml";

@Key ("kml:Placemark") // adding this always fails with Bad Request

public FeaturePlaceMark placemark; // adding this always fails with Bad Request

public FeatureContent() { //required }

public FeatureContent(FeaturePlaceMark placemark) { this.placemark = placemark; } }

FEED_NAMESPACE_DICTIONARY.namespaceAliasToUriMap; feedMap.put("", "http://www.w3.org/2005/Atom"); feedMap.put("kml", "http://www.opengis.net/kml/2.2"); feedMap.put("atom", "http://www.w3.org/2005/Atom"); feedMap.put("exif", "http://schemas.google.com/photos/exif/2007"); feedMap.put("gd", "http://schemas.google.com/g/2005"); feedMap.put("gm", "http://schemas.google.com/g/2008#mapfeature"); feedMap.put("geo", "http://www.w3.org/2003/01/geo/wgs84_pos#"); feedMap.put("georss", "http://www.georss.org/georss"); feedMap.put("gml", "http://www.opengis.net/gml"); feedMap.put("gphoto", "http://schemas.google.com/photos/2007"); feedMap.put("media", "http://search.yahoo.com/mrss/"); feedMap.put("openSearch", "http://a9.com/-/spec/opensearch/1.1/"); feedMap.put("xml", "http://www.w3.org/XML/1998/namespace");


I have been there too... And when I delete this sentence url.fields = GData.getFieldsFor(FeatureFeed.class);,the program runs well,weird but effective. You can try it out.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜