Recent activity
Subscribe to this feed
Jayakumar asked a question in Modest Maps on August 12, 2009 07:42:
Routing in customize mapDear All,
Is it possible to develop routing functions in the customize map. If yes I need sample.
regards
K.JAYAKUMAR
Jayakumar asked a question in Modest Maps on July 21, 2009 10:12:
Tile load slowlyDear All,
While displaying map in Adobe flex the tiles are loading very slowly. I used to dumbed the data's in PostgreSQL, and WMS in geoserver.
Is any body know what's the reason is?
Here is the coding
----------------------
/**
* MapProvider for a WMS server, in either EPSG:4326 or EPSG:900913
*/
package com.modestmaps.mapproviders
{
import com.modestmaps.core.Coordinate;
import com.modestmaps.geo.LinearProjection;
import com.modestmaps.geo.Location;
import com.modestmaps.geo.Transformation;
import flash.net.URLVariables;
public class WMSMapProvider extends AbstractMapProvider implements IMapProvider
{
public static const EPSG_4326:String = "EPSG:4326";
public static const EPSG_900913:String = "EPSG:900913";
public static const DEFAULT_PARAMS:Object = {
FORMAT: 'image/png',
VERSION: '1.1.1',
SERVICE: 'WMS',
REQUEST: 'GetMap',
SRS: 'EPSG:4326',
WIDTH: '512',
HEIGHT: '512',
BGCOLOR: '0xF2EFE9'
};
private var serverUrl:String;
private var wmsParams:Object;
private var wms:String;
public var layers:Array;
public function WMSMapProvider(serverURL:String, wmsParams:Object=null)
{
super();
layers = ['stateboundary','area_try','streams','waterbodies','road_network','rail_roads','majorcities'];
if (!wmsParams) wmsParams = DEFAULT_PARAMS;
this.serverUrl = serverURL;
this.wmsParams = wmsParams;
var data:URLVariables = new URLVariables();
for (var param:String in wmsParams) {
data[param] = wmsParams[param];
}
this.wms = "?" + data.toString();
if (wmsParams['SRS'] == EPSG_4326) {
var t:Transformation = new Transformation(166886.05360752725, 0, 524288, 0, -166886.05360752725, 524288);
__projection = new LinearProjection(20, t);
}
else if (wmsParams['SRS'] && wmsParams['SRS'] != EPSG_900913) {
throw new Error("[WMSMapProvider] Only Linear and (Google-style) Mercator projections are currently supported");
}
}
public function getTileUrls(coord:Coordinate):Array
{
var worldSize:int = Math.pow(2, coord.zoom);
if (coord.row < 0 || coord.row >= worldSize) {
return [];
}
var sourceCoord:Coordinate = sourceCoordinate(coord);
var bottomLeftCoord:Coordinate = sourceCoord.down();
var topRightCoord:Coordinate = sourceCoord.right();
var boundingBox:String;
var laywms:String = this.wms + "&layers=";
var first:Boolean = true;
for each(var lay:String in layers) {
if(!first) {
laywms = laywms + ",";
}
first = false;
laywms = laywms + lay;
}
if (wmsParams['SRS'] == EPSG_4326) {
// lat-lon is easy
var bottomLeftLocation:Location = coordinateLocation(bottomLeftCoord);
var topRightLocation:Location = coordinateLocation(topRightCoord);
boundingBox = '&BBOX=' + [ bottomLeftLocation.lon.toFixed(5),
bottomLeftLocation.lat.toFixed(5),
topRightLocation.lon.toFixed(5),
topRightLocation.lat.toFixed(5) ].join(',')
return [serverUrl + laywms + boundingBox];
}
var quadrantWidth:Number = 20037508.34;
var magicZoom:Number = Math.log(2*quadrantWidth) / Math.LN2;
bottomLeftCoord = bottomLeftCoord.zoomTo(magicZoom);
topRightCoord = topRightCoord.zoomTo(magicZoom);
// flip and offset so we have correct minx,miny,maxx,maxy
var minx:Number = bottomLeftCoord.column - quadrantWidth;
var miny:Number = quadrantWidth - bottomLeftCoord.row;
var maxx:Number = topRightCoord.column - quadrantWidth;
var maxy:Number = quadrantWidth - topRightCoord.row;
boundingBox = '&BBOX=' + [ minx.toFixed(5), miny.toFixed(5), maxx.toFixed(5), maxy.toFixed(5) ].join(',')
return [ serverUrl + laywms + boundingBox ];
}
public function toString() : String
{
return "WMS";
}
override public function get tileWidth():Number
{
return 512;
}
override public function get tileHeight():Number
{
return 512;
}
}
}
regards
K.JAYAKUMAR
Jayakumar asked a question in Modest Maps on July 07, 2009 06:06:
Jayakumar asked a question in Modest Maps on July 02, 2009 04:20:
MARKER CLIPDear All,
How to add marker clip in the map for the given lat/long. Can any send me sample coding.
regards
K.JAYAKMAR
Jayakumar asked a question in Modest Maps on May 20, 2009 10:48:
Navigate windowHow to create Navigate window in separate area. Not in map area. If possible send me the sample , I am new to this.
Loading Profile...
