Windows Phone 7 and WMS test

  Update #1  13/03/2013, here is new  blog about Tiled WMS overlay for Windows Phone 8 :https://blog.sumbera.com/2013/03/10/tiled-wms-overlay-in-windows-phone-8/

I have quickly tested my new Windows Phone 7 (Samsung Omnia) device with the Czech cadastral map WMS overlay over the BingMaps and DeepEarth (also see this blog here: https://blog.sumbera.com/2010/11/10/wms-overlay-on-bing-maps-vs-deepearth-on-wp7/) . if you are familiar with www.ikatastr.cz and iPhone version of it (iKatastr) than this example is using same data sources.

In short : it was a great experience – WP7 was smoothly  registered, automaticaly connected to internet even without  a SIM card using USB cable and Visual Studio 2010 integration just works perfect (so far:) In comparison to many difficulties and ‘certification hell’ on iPhone this is a great relief. Now giving the fact that Nokia is going to support and develop Windows Phone 7, great user experience with WP7 and (for me and menay others) great development experience, this might change the mobile landscape significantly over the 1 or 2 years.

I will guess here that WP7 platform will exceed number of iPhone applications in less than 2 years.  

Update #2 Reviewing this after 2 years (March / 2013), –  something went wrong with this estimation, but do you remember Gartner predictions from that time ? for example here : http://www.globalnerdy.com/2012/05/07/the-windows-phone-predictions-that-idc-gartner-and-pyramid-research-probably-hope-youve-forgotten/

but we are not yet in 2015, so we will see.

Update #3 02/2016 : this estimation was completely  wrong , Windows Phone platform is nowhere, looks like great lesson learned – even you own great language and framework (C# and .NET) there is nothing that guarantees you being successful on emerging/disruptive platform/form factor. Objective-C (then Swift) or Java on Android got this mobile cake.

Tiled WMS overlay on Google Map v3

this is the third sample of the tiled WMS overlay over the Spherical Mercator, this time over the new Google Map v3. Previsous post talked about overlyaing WMS in  Silverlight Bing maps (https://blog.sumbera.com/2010/02/25/overlay-wms-on-google-in-silverlight-bing/ ) and OpenLayers (https://blog.sumbera.com/2010/02/17/overlay-wms-on-google-in-openlayers/).

Sample application can be found here: http://www.sumbera.com/lab/GoogleV3/tiledWMSoverlayGoogleV3.htm You can try to run it on your mobile device as well – suprisingly it run very well on my iPhone (sometimes it just crash Safari :), however on the iPad there are some more serious issues that will be hopefuly resolved with new iOS update (JavaScript stops to run).

For the new Google Map v3 you have to do the following :

//Define custom WMS tiled layer

var SLPLayer = 
 new google.maps.ImageMapType (
 {
  getTileUrl:
    function (coord, zoom) { 
      var proj = map.getProjection(); 
      var zfactor = Math.pow(2, zoom); 
       // get Long Lat coordinates
      var top = proj.fromPointToLatLng(
             new google.maps.Point(coord.x * 256 / zfactor, coord.y * 256 / zfactor) ); 
      var bot = proj.fromPointToLatLng(
            new google.maps.Point((coord.x + 1) * 256 / zfactor, (coord.y + 1) * 256 / zfactor)); 
      //corrections for the slight shift of the SLP (mapserver)
       var deltaX = 0.0013; 
       var deltaY = 0.00058; 
      
      //create the Bounding box string
       var bbox = (top.lng() + deltaX) + "," +(bot.lat() + deltaY) +","
                           +(bot.lng() + deltaX) +"," +(top.lat() + deltaY);
      
       //base WMS URL
        var url = 
       "http://mapserver-slp.mendelu.cz/cgi-bin/mapserv?map=/var/local/slp/krtinyWMS.map&" ;
       url +="&REQUEST=GetMap"; //WMS operation
       url +="&SERVICE=WMS"; //WMS service
       url +="&VERSION=1.1.1"; //WMS version 
       url +="&LAYERS=" + "typologie,hm2003"; //WMS layers
       url +="&FORMAT=image/png"; //WMS format
       url +="&BGCOLOR=0xFFFFFF" ;
       url +="&TRANSPARENT=TRUE" ;
       url +="&SRS=EPSG:4326"; //set WGS84 
       url +="&BBOX="+ bbox; // set bounding box
       url +="&WIDTH=256"; //tile size in google
       url +="&HEIGHT=256" ; 
       return url; // return URL for the tile    
     }, //getTileURL

 tileSize: new google.maps.Size(256, 256),
 isPng: true
 });

//add WMS layer
 map.overlayMapTypes.push(SLPLayer); 

 
 
 

Overlay WMS on Google in OpenLayers

[Note: therea are related post: overlyaing tiled WMS over the new Google Map v3 https://blog.sumbera.com/2010/11/02/tiled-wms-overlay-on-google-map-v3/ and overlying tiled WMS over the Silverlight Bing map https://blog.sumbera.com/2010/02/25/overlay-wms-on-google-in-silverlight-bing/ ]

Is it possible to display WMS (EPSG:4326) over the Google (EPSG:900913) in Openlayers ? Yes ! thanks to the great img ‘feature’ that enables you to shrink/expand your return image based on defined image size. That means that if your map view is rectangular or you request WMS as tiles (rectangular too) you get proper overlay of EPSG:4326 on EPSG:900913) . Example of various image sizes follows (these are actually WMS GetMap requests):

256 x 160
256 x 256

Here is the way how to implement it in OpenLayers – very simplified:

1. read this post http://docs.openlayers.org/library/spherical_mercator.html and create your Google map:

var options = {
projection: new OpenLayers.Projection(“EPSG:900913”),
displayProjection: new OpenLayers.Projection(“EPSG:4326”),
units: “m”,
numZoomLevels: 22,
maxExtent: new OpenLayers.Bounds(-20037508, -20037508,
20037508, 20037508.34)
};
map = new OpenLayers.Map(‘map’, options);
            // create Google Mercator layers
            var ghyb = new OpenLayers.Layer.Google(
“Google Hybrid”,
{ type: G_HYBRID_MAP, ‘sphericalMercator’: true }
);

2. add your WMS layer

var gwms = new OpenLayers.Layer.TMS(“SLP”, “http://mapserver-slp.mendelu.cz/cgi-bin/mapserv?map=/var/local/slp/krtinyWMS.map&”,
{
layers: ‘obrys,typologie,hm2003’,
type: ‘png’,
visibility: true,
getURL: get_wms_url,
format: “image/png”,
opacity: 1,
isBaseLayer: false,
deltaX: 0.0013,
deltaY: 0.00058
});

3. include support for reprojection before you include OpenLayers:

<script src =”proj4js/lib/proj4js-combined.js”>script>

4. handle WMS as TMS tiles as this:

function get_wms_url(bounds) {

// recalculate bounds from Google to WGS
var proj = new OpenLayers.Projection(“EPSG:4326”);
bounds.transform(map.getProjectionObject(), proj);

// this is not necessary for most servers display overlay correctly,
//but in my case the WMS  has been slightly shifted, so I had to correct this with this delta shift

bounds.left += this.deltaX;
bounds.right += this.deltaX;
bounds.top += this.deltaY;
bounds.bottom += this.deltaY;

            //construct WMS request

var url = this.url;
url += “&REQUEST=GetMap”;
url += “&SERVICE=WMS”;
url += “&VERSION=1.1.1”;
url += “&LAYERS=” + this.layers;
url += “&FORMAT=” + this.format;
url += “&TRANSPARENT=TRUE”;
url += “&SRS=” + “EPSG:4326”;
url += “&BBOX=” + bounds.toBBOX();
url += “&WIDTH=” + this.tileSize.w;
url += “&HEIGHT=” + this.tileSize.h;
return url;

}

That is, live example you can see here http://www.sumbera.com/lab/wms/getcapWGS.htm

or in MapShake here : http://www.mapshake.cz/mapfs.aspx?i=464

WhateverMap on Apple Store

WhateverMap Lite v1.0, developed by Jiri Kaminek  has been today accepted for distribution through Apple Store . You can download it here (iTunes and iPhone requiered):

tms://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=326649571&mt=8&s=143441

WhateverMap is similar to Google Maps but you can use different branch-specific map sources. Those sources should be more interesting and valuable in non-navigation filed of map using. WhateverMap use Web Map Services (WMS). WMS standard specification was created by the Open Geospatial Consortium (OGC). WMS may provide any geospatial data. There are many WMS severs and most of them are available for free. You can find servers with ortophoto, cadastral, soil types, migration of white storks, … simply WHATEVER.
You can add any WMS server by typing an URL address or simply use built-in catalog. There are some servers with interesting data as NASA Earth satellite photos, Mars satellite photos and many others. There is a rich list of Czech WMS servers.
You can browse a map using zoom-in, zoom-out or move. For better orientation it is possible to use actual position provided by built-in GPS module. Each WMS should map only limited area so there is a boundary of each map. It is possible to display whole map with boundary too.
It is possible to consume many sources in this application. So there is an easy way to change a source while browsing the map. You can easily compare the same area in different map sources. For example you can find out any building and then you can choose soil type map to determine stability of building’s foundation.
For better control of map there is a movement history. Sometimes GPS get lost a signal and display non-precision region. In this case it is posible to use undo and get more precision area before you get lost a signal. There is another interesting way to use the history. You can move around an area in first map layer and then use the same movements in different layers. For example you can follow a road and then you can use map layer with water or soil pollution to find out effect of road to water or soil quality.

MAP CONTROL:
・ZOOM-IN – double tap
・ZOOM-OUT – triple tap
・MOVEMENT – swipe on map

FEATURES:
– Consume any WMS server map data (ortofoto, cadastral, mars, … WHATEVER)
– Map browsing (move, zoom)
– Support history in map movements (UNDO, REDO)
– Display your current location
– Display map boundary
– Change background color
– Movement history(UNDO, REDO)
– favourite list of WMS

WHAT TO EXPECT IN THE NEXT RELEASES:
– searching by location name (city, roads, country, …) – geocoding
– caching
– saving for offline use
– better catalog
– landmarks

WHAT’S NEW IN THIS VERSION:
first release

LANGUAGES:
English

REQUIREMENTS:
Compatible with iPhone and iPod Touch
Requires iPhone OS 2.2.1 or later

What’s new

English

Screenshots