I have created a public map called "test-map" to test this. I'm using a
Java class to create the test. The method's code is at the end of this
response.
The return code, overall and for every entry is "success". But the map and
POIs remain unchanged.
Note: I know that there are specific methods for getting "URLs" but I
checked that they are what I'm using in the test.
/****** JAVA CODE *****/
MapsService myService = new MapsService("yourCo-yourAppName-v1");
myService.setUserCredentials(user,pwd);
batchUpdateMap (myService);
private void batchUpdateMap(MapsService myService) throws ServiceException,
IOException {
// Request feature info
FeatureFeed feed1 = new FeatureFeed();
FeatureEntry entry1 = new FeatureEntry();
entry1.setId("http://maps.google.com/maps/feeds/features/212026791974164037226/0004...");
BatchUtils.setBatchId(entry1, "Batch-Id-Query-1");
BatchUtils.setBatchOperationType(feed1, BatchOperationType.QUERY);
feed1.getEntries().add(entry1);
final URL batchMapUrl = new
URL("http://maps.google.com/maps/feeds/features/212026791974164037226/0004...");
FeatureFeed result = myService.batch(batchMapUrl, feed1);
// Iterates resulting feed adding entries to a new feed for
updating. Note: There should be just one entry
FeatureFeed updatingFeed = new FeatureFeed();
for (FeatureEntry entry : result.getEntries()) {
// Traces some info
String batchId = BatchUtils.getBatchId(entry);
BatchStatus status = BatchUtils.getBatchStatus(entry);
System.out.println("Batch operation: " + batchId + " status ("
+ status.getReason() + ") " + status.getContent());
// Creates a new entry from previous one and updates it
FeatureEntry updatingEntry = new FeatureEntry(entry);
updatingEntry.setTitle(new PlainTextConstruct("changedPOI"));
XmlBlob kml = new XmlBlob();
kml.setBlob("<Placemark><name>changedPOI</name><description/><Style
id=\"style11\"><IconStyle><Icon><href>http://maps.gstatic.com/mapfiles/ms2/micons/blue-dot.png</href></Icon></IconStyle></Style><Point><coordinates>-5.812011,42.21244,0. 0</coordinates></Point></Placemark>");
updatingEntry.setKml(kml);
BatchUtils.setBatchId(updatingEntry, "Batch-Id-Update-1");
BatchUtils.setBatchOperationType(updatingEntry,
BatchOperationType.UPDATE);
updatingEntry.setSummary(new PlainTextConstruct("updating
info"));
// Adds it to the feed
updatingFeed.getEntries().add(updatingEntry);
}
// Sends the batch updating request
result = myService.batch(batchMapUrl, updatingFeed);
// Iterates the result again showing the status
for (FeatureEntry entry : result.getEntries()) {
// Traces some info
String batchId = BatchUtils.getBatchId(entry);
BatchStatus status = BatchUtils.getBatchStatus(entry);
System.out.println("Batch operation: " + batchId + " status ("
+ status.getReason() + ") " + status.getContent());
}
}