Jul 272013
 

It’s all over the news. Well, something like that. It spiked my interest and I installed Waze on my phone. It looks cute, and for people without paranoia (you will be sharing your location), it can be both fun and helpful. One of the features is that it lists gasstations nearby. Not so spectacular, it’s on Google Maps too you might say. But Waze lists them sorted by distance from your current location including the current fuel prices. So, let’s save ourselves some money, and start using Waze 🙂

Waze on Google Play.

Jul 122013
 

The solution I’m creating for the client is based on Google Maps, so when I showed them some results, they joked that they wouldn’t be able to sell their product to Microsoft, since it’s not based on Bing Maps.

Replacing the basis with Bing Maps is no problem however. But since the map in this solution is used as an entry to filter the data (you draw the region you want to query), I need a (free form) drawing library of some sort. There is no drawing support in Bing Maps what so ever. The only thing present is the Shape Toolbox module someone created back in 2012, and never maintained/updated. Why is there no support for drawing on the map?

To make things worse, if I wanted to create something myself (I learned a thing or two playing with Google Maps) the mouse event returns X and Y values of the screen, not the coordinates on the map where the mouse event took place, so if I want to create something myself, I need to be recalculate the X and Y values to mapcoordinates every single time. There’s a function for it, but it’s a stupid decision to implement it this way. It should be the other way around, because how often would you really need the X and Y values of the screen?

That was my rant. Grrrr….

Jul 042013
 

I found a script to simplify polygons in Google Maps, basically to reduce the number of nodes the polygon is build up from. It does that by some sort of smoothing algorithm, with a distance parameter. Anything under that distance is smoothed out (read: deleted). It’s a Google Maps V2 script, but I modified it to work with V3.

This is the original: Stack-based Douglas Peucker line simplification routine by Dr. Gary J. Robinson. Let me know if you need the V3 script, but it shouldn’t be a problem to do the modifications yourself.

When I set the tolerance (kink as it’s called in the script) to 10 (meter), my polygons have a node drop from almost 600 to about 30, and still look about the same as what was drawn. I can still optimize the query a little to only use 7 decimal digits on the lats/longs, but for now that’s not needed.

Come to think of it, the amount of smoothing should be linked to the zoomlevel the map is at when drawing the polygon.

Update 18-Aug-2016: The V3 file is this one.

Jul 042013
 

I created a routine (Javascript) to do some free form drawing of a polygon in Google Maps, as opposed to the standard point-per-click polygon that comes with the standard library. Everything works great. The polygon is used to query a database (you’re drawing your filter, so to speak). A simple polygon around Amsterdam however results in a 900+ points polygon, making the query-string over 45K. Wow. That needs some optimization!

Jun 252013
 

The Google Maps API introduces styling of maps, like most people know when using OpenLayers (via SLDs) or OpenStreetMap (where you can create your own style, and share it with others). Google Maps styling is done in Javascript, as an extra option when creating the map. So there is no sharing option, and it’s not based on the SLD-standard, but I still think it’s a nice addition. Sometimes you don’t need the full color map, since it can distract from what you are showing.

Read more about the styling here.

You do need to set the visualRefresh to true, this will be the default in Google Maps API 3.14 and above.

google.maps.visualRefresh = true;
Jun 042013
 

If you need to use Google’s tiles in LeafletJS, you can follow the same URL structure as OpenStreetMap. The tile servers are mt0 .. mt3, and the XYZ are specified a little differently. Here you go:

L.tileLayer('http://{s}.google.com/vt/x={x}&y={y}&z={z}', {
            subdomains : ['mt0','mt1','mt2','mt3'],
            attribution: 'Tiles Courtesy of <a href="http://maps.google.com" target="_blank">Google</a>',
            maxZoom: 18
            }).addTo(map);
Sep 122011
 

This is a post to say that I created a -very basic- WFS client on Android. It gets point-features from GeoServer in GeoJSON format and displays them on top of a Google Maps view. You can only zoom in and out, and pan the map at the moment, but I made it work. YEAH!

Sep 092011
 

I’m creating a Maps applicition on Android. I had my location in an ItemizedOverlay, displaying a man-icon (similar to the yellow streetview marker). Then I wanted to add a layer with markers, so I created another ItemizedOverlay. But I can’t seem to add that to my MapView. As soon as I do that, I get a Forced Close.

Changing the first ItemizedOverlay to a MyLocationOverlay does not do the trick, the FC still kicks in as soon as I try to add the second overlay. I must be doing something wrong…….

Update: the initial code was created very late at night. And then things get mixed up. Don’t use before instantiate….DUH. Needless to say, it works now 😉

Jun 172011
 

When installing the Android development toolkit on Windows, you might find yourself stuck on the second screen on the wizard, because the installer can’t find the JDK you installed. The following is not a joke. Press BACK to go to the title screen, press NEXT to return to the second screen, and….voila. The installer found the JDK. Remember, this is NOT a joke.