Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using openscales in a web mapping project, i would like to add a Google maps layer, i know that there's some licence problems , but i don't care for these licence issues, i'm looking to add googlemaps layer to openscales like it has been made on OpenLayers.

Thanks in advance

share|improve this question
you can use wms service like - but your ip can be blocked by google if it is they deem it not an acceptable method in using their mapping tiles – Mapperz Mar 12 '12 at 15:12
Thanks a lot Mapperz, i will give a try for this solution :) – geogeek Mar 13 '12 at 9:03
up vote 1 down vote accepted

You must create your own TMS layer and server side proxy script with crossdomain.xml

package openscalesmap {

import org.openscales.core.layer.TMS;
import org.openscales.geometry.basetypes.Bounds;
import org.openscales.geometry.basetypes.Location;
import org.openscales.proj4as.ProjProjection;
import flash.system.Security;

public class GoogleMap extends TMS
    private var _serviceVersion:String = "1.0.0";       
    private var _tileOrigin:Location = null;        
    private var _format:String = "png";     
    private var _layerName:String;
    private var _type:String;
    private var _proxy_url:String="";

    public static const HYBRID:String="";
    public static const SAT:String="";
    public static const STANDART:String="";

    public function GoogleMap(name:String, url:String, layerName:String="", type:String=SAT)
        super(name, url, layerName);
    /*  Security.loadPolicyFile("");
        Security.allowDomain( "*" );
        Security.allowInsecureDomain( "*" );*/
        this.projection = new ProjProjection("EPSG:900913");
        this._layerName = layerName;
        this.maxExtent = new Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34);
    override public function getURL(bounds:Bounds):String {
        var res:Number =;
        if(this._tileOrigin==null) {
            this._tileOrigin = new Location(this.maxExtent.left,this.maxExtent.bottom);

        var x:Number = Math.round((bounds.left - this.maxExtent.left) / (res * this.tileWidth));
        var y:Number = Math.round(( - / (res * this.tileHeight));
        var z:Number =;
        var limit:Number = Math.pow(2, z);

        x = ((x % limit) + limit) % limit;
        y = ((y % limit) + limit) % limit;
        var url:String =_proxy_url+escape(_type + "&z=" + z + "&x=" + x + "&y=" + y); 

        if (this.altUrls != null) {
            url = this.selectUrl(this.url, this.getUrls());

        return url ;


And change these lines for your language:

public static const HYBRID:String="";
public static const SAT:String="";
public static const STANDART:String="";
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.