google maps api : internal server error when inserting a feature
Posted
by user142764
on Stack Overflow
See other posts from Stack Overflow
or by user142764
Published on 2010-01-04T10:42:41Z
Indexed on
2010/06/10
3:52 UTC
Read the original article
Hit count: 406
google-maps-api
Hi,
I try to insert features on a custom google map : i use the sample code from the doc but i get a ServiceException (Internal server error) when i call the service's insert method.
Here is what i do :
- I create a map and get the resulting MapEntry object :
myMapEntry = (MapEntry) service.insert(mapUrl, myEntry);
This works fine : i can see the map i created in "my maps" on google.
- I use the feed url from the map to insert a feature :
final URL featureEditUrl = myMapEntry.getFeatureFeedUrl();
- I create a kml string using the sample from the doc :
String kmlStr = "< Placemark xmlns=\"http://www.opengis.net/kml/2.2\">" + "<name>Aunt Joanas Ice Cream Shop</name>" + "<Point>" + "<coordinates>-87.74613826475604,41.90504663195118,0</ coordinates>" + "</Point></Placemark>";
- And when i call the insert method i get an internal server error.
I must be doing something wrong but i cant see what, can anybody help ?
Here is the complete code i use :
public void doCreateFeaturesFormap(MapEntry myMap)
throws ServiceException, IOException {
final URL featureEditUrl = myMap.getFeatureFeedUrl();
FeatureEntry featureEntry = new FeatureEntry();
try {
String kmlStr = "<Placemark xmlns=\"http://www.opengis.net/kml/
2.2\">"
+ "<name>Aunt Joanas Ice Cream Shop</name>"
+ "<Point>"
+ "<coordinates>-87.74613826475604,41.90504663195118,0</
coordinates>"
+ "</Point></Placemark>";
XmlBlob kml = new XmlBlob();
kml.setFullText(kmlStr);
featureEntry.setKml(kml);
featureEntry.setTitle(new PlainTextConstruct("Feature Title"));
} catch (NullPointerException e) {
System.out.println("Error: " + e.getClass().getName());
}
FeatureEntry myFeature = (FeatureEntry) service.insert(
featureEditUrl, featureEntry);
}
Thanks in advance, Vincent.
© Stack Overflow or respective owner