How do I create a dark Google Maps image for Google Glass? -


i need create dark/inverted map image use on google glass, since standard google static maps image bright when displayed on screen. how can customize map theme on glass?

the google static maps api provides number of customization options change colors of map features. here's example of activity loads dark/inverted static map image , displays in full-screen imageview on glass.

the description of query parameters used construct url can found in documentation google maps static maps api.

public class staticmapactivity extends activity {      private static final string tag = staticmapactivity.class.getsimplename();      private static final string static_map_url_template =             "https://maps.googleapis.com/maps/api/staticmap"             + "?center=%.5f,%.5f"             + "&zoom=%d"             + "&sensor=true"             + "&size=640x360"             + "&scale=1"             + "&style=element:geometry%%7cinvert_lightness:true"             + "&style=feature:landscape.natural.terrain%%7celement:geometry%%7cvisibility:on"             + "&style=feature:landscape%%7celement:geometry.fill%%7ccolor:0x303030"             + "&style=feature:poi%%7celement:geometry.fill%%7ccolor:0x404040"             + "&style=feature:poi.park%%7celement:geometry.fill%%7ccolor:0x0a330a"             + "&style=feature:water%%7celement:geometry%%7ccolor:0x00003a"             + "&style=feature:transit%%7celement:geometry%%7cvisibility:on%%7ccolor:0x101010"             + "&style=feature:road%%7celement:geometry.stroke%%7cvisibility:on"             + "&style=feature:road.local%%7celement:geometry.fill%%7ccolor:0x606060"             + "&style=feature:road.arterial%%7celement:geometry.fill%%7ccolor:0x888888";      /** formats google static maps url specified location , zoom level. */     private static string makestaticmapsurl(double latitude, double longitude, int zoom) {         return string.format(static_map_url_template, latitude, longitude, zoom);     }      private imageview mmapview;      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);          mmapview = new imageview(this);         setcontentview(mmapview);          loadmap(37.8019, -122.4189, 18);     }      /** load map asynchronously , populate imageview when it's loaded. */     private void loadmap(double latitude, double longitude, int zoom) {         string url = makestaticmapsurl(latitude, longitude, zoom);         new asynctask<string, void, bitmap>() {             @override             protected bitmap doinbackground(string... urls) {                 try {                     httpresponse response = new defaulthttpclient().execute(new httpget(urls[0]));                     inputstream = response.getentity().getcontent();                     return bitmapfactory.decodestream(is);                 } catch (exception e) {                     log.e(tag, "failed load image", e);                     return null;                 }             }              @override             protected void onpostexecute(bitmap bitmap) {                 if (bitmap != null) {                     mmapview.setimagebitmap(bitmap);                 }             }         }.execute(url);     } } 

Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -