Failed to Batch-Update a map

62 views
Skip to first unread message

JZarzuela

unread,
Jan 19, 2012, 7:10:28 PM1/19/12
to google-map...@googlegroups.com
Hi,

I've been looking for an anwser for the following issue without luck:

I'm able to update any FeatureEntry of my maps using "regular" update calls (mapService.update(featureEditUrl, featureEntry)). And I'm able to insert new entries with batch calls too. But, it fails when I try to update them in a batch call.

The response is always "OK" but the content is left unchanged.

Any help would appreciated.

Thanks

bart (Google Employee)

unread,
Jan 20, 2012, 7:36:23 PM1/20/12
to Google Maps Data API
Can you post an example of the batch command you're sending, and the
URL you're sending it to?
Are the per-entry responses OK as well? A batch POST should always
return overall success, with per-entry responses as part of the
response.

JZarzuela

unread,
Jan 22, 2012, 2:35:47 PM1/22/12
to google-map...@googlegroups.com
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();
        BatchUtils.setBatchId(entry1, "Batch-Id-Query-1");
        BatchUtils.setBatchOperationType(feed1, BatchOperationType.QUERY);
        feed1.getEntries().add(entry1);
        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());
        }
}

Reply all
Reply to author
Forward
0 new messages