protected override void ReadTilingScheme(out TilingScheme tilingScheme) { ReadBaiduTilingScheme(out tilingScheme); Util.Envelope initial = tilingScheme.InitialExtent; Util.Point pLeftTop = Utility.GeographicToWebMercator(new Util.Point(initial.XMin, initial.YMax)); Util.Point pRightBottom = Utility.GeographicToWebMercator(new Util.Point(initial.XMax, initial.YMin)); tilingScheme.InitialExtent = new Envelope(pLeftTop.X, pRightBottom.Y, pRightBottom.X, pLeftTop.Y); this.TilingScheme = TilingSchemePostProcess(tilingScheme); }
public TilingScheme getBaiDuSchema(double left, double right, double top, double bottom) { TilingScheme tilingScheme = getBaiDuSchema(); Point leftBottom = new Point(left, bottom); Point rightTop = new Point(right, top); tilingScheme.InitialExtent = new Envelope(leftBottom.X, leftBottom.Y, rightTop.X, rightTop.Y); return(tilingScheme); }
protected override void ReadTilingScheme(out TilingScheme tilingScheme) { tilingScheme = SchemaProvider.Inst.getSchema("BaiDuOnline", "default", null); //this.TilingScheme = TilingSchemePostProcess(tilingScheme); if (_mapName.ToLower().Contains("image")) { this.TilingScheme.CacheTileFormat = ImageFormat.JPG; } }
protected override void ReadTilingScheme(out TilingScheme tilingScheme) { ReadGoogleMapsTilingScheme(out tilingScheme); this.TilingScheme = TilingSchemePostProcess(tilingScheme); if (_mapName.ToLower().Contains("image")) { this.TilingScheme.CacheTileFormat = ImageFormat.JPG; } }
protected override void ReadTilingScheme(out TilingScheme tilingScheme) { if (this.TilingScheme.Path == null) { ReadGoogleMapsTilingScheme(out tilingScheme); } else { ReadArcGISTilingSchemeFile(this.TilingScheme.Path, out tilingScheme); } this.TilingScheme = TilingSchemePostProcess(tilingScheme); }
/// <summary> /// /// </summary> /// <param name="packetSize">When PacketSize=128, this bundle is a ArcGIS compact bundle, when PacketSize=16, this bundle is a ArcGIS supertile.</param> /// <param name="level">the level which this bundle belongs.</param> /// <param name="row">row number of this bundle in the level.</param> /// <param name="col">column number of this bundle in the level.</param> /// /// <param name="ts">using for calculate the bounding box.</param> public Bundle(int packetSize, int level, int row, int col, TilingScheme ts) { PacketSize = packetSize; Row = row; Col = col; Level = level; TilingScheme = ts; _startTileRow = PacketSize * Row; _startTileCol = PacketSize * Col; _endTileRow = (Row + 1) * PacketSize - 1; _endTileCol = (Col + 1) * PacketSize - 1; }
protected override void ReadTilingScheme(out TilingScheme tilingScheme) { ReadGoogleMapsTilingScheme(out tilingScheme); this.TilingScheme = tilingScheme; try { this.TilingScheme.InitialExtent = this.TilingScheme.FullExtent = GetGaodeCacheExtent(); } catch (Exception e) { throw new Exception("Get init extent error!\r\n" + e.Message); } this.TilingScheme = TilingSchemePostProcess(tilingScheme); }
public DataSourceArcGISImageService(string path, string tilingSchemePath) { if (path.Trim() == string.Empty) { throw new Exception("service url is empty!"); } this.Path = path; ValidateServices(); TilingScheme = new TilingScheme(); if (tilingSchemePath != null) { this.TilingScheme.Path = tilingSchemePath; } Initialize(path); }
/// <summary> /// /// </summary> /// <param name="path"></param> /// <param name="tilingSchemePath"></param> /// <param name="serviceName">In case tile need to be cached to local file, using for determine the local cache file name.</param> public DataSourceRasterImage(string path, string tilingSchemePath, string serviceName) { TilingScheme = new TilingScheme(); if (tilingSchemePath != null) { this.TilingScheme.Path = tilingSchemePath; } Initialize(path); if (ConfigManager.App_AllowFileCacheOfRasterImage) { //init local cache file if does not exist. string localCacheFileName = ConfigManager.App_FileCachePath + "\\" + serviceName.Trim().ToLower() + ".cache"; ValidateLocalCacheFile(localCacheFileName); TileLoaded += new EventHandler <TileLoadEventArgs>(InternalOnTileLoaded); } }
public void Add(string dataSourceSubType, string dataSourceName, TilingScheme schema) { string key = dataSourceSubType == null ? "default" : dataSourceSubType; SubTypeSchemas s2; if (!_TSchemas.ContainsKey(key)) { s2 = new SubTypeSchemas(); _TSchemas.Add(key, s2); } else { s2 = _TSchemas[key]; } s2.Add(dataSourceName, schema); }
public DataSourceWMSService(string path, string tilingSchemePath) { this.Path = path; ValidateServices(); LayerList = new ObservableCollection <LayerInfo>(); ParseCapabilities(XDocument.Parse(_xmlDoc)); TilingScheme = new TilingScheme(); if (tilingSchemePath != null) { this.TilingScheme.Path = tilingSchemePath; } Initialize(path); if (!SupportedSpatialReferenceIDs.Contains(TilingScheme.WKID)) { throw new Exception(string.Format("Input WMS service doesn't support the WKID({0}) specified in tiling scheme file\r\n\r\nSupported WKIDs:{1}", TilingScheme.WKID, string.Join(",", SupportedSpatialReferenceIDs))); } }
protected override void ReadTilingScheme(out TilingScheme tilingScheme) { //validate MAC tile field using (SQLiteCommand sqlCmd = new SQLiteCommand("SELECT image FROM tiles", _sqlConn)) { try { object o = sqlCmd.ExecuteScalar(); } catch (Exception e) { throw new Exception("Selected file is not a valid MobileAtlasCreator file\r\n" + e.Message); } } ReadSqliteTilingScheme(out tilingScheme, _sqlConn); this.TilingScheme = TilingSchemePostProcess(tilingScheme); }
protected override void ReadTilingScheme(out TilingScheme tilingScheme) { ReadGoogleMapsTilingScheme(out tilingScheme); this.TilingScheme = TilingSchemePostProcess(tilingScheme); //if (_mapName.ToLower().Contains("image")) //this.TilingScheme.CacheTileFormat = ImageFormat.JPG; //gisweis:修改瓦片格式 //有的GIS平台不支持JPG格式的WMTS服务,如如超图 if (_strTilesFormat.ToUpper().Contains("PNG")) { this.TilingScheme.CacheTileFormat = ImageFormat.PNG; } else { this.TilingScheme.CacheTileFormat = ImageFormat.JPG; } }
public TilingScheme getBaiDuSchema() { TilingScheme tilingScheme = new TilingScheme(); StringBuilder sb; tilingScheme.Path = "N/A"; tilingScheme.CacheTileFormat = ImageFormat.PNG; tilingScheme.CompressionQuality = 75; tilingScheme.DPI = 96; //LODs tilingScheme.LODs = new LODInfo[20]; double resolution = 262144; double scale = 990780472.44094491; for (int i = 0; i < tilingScheme.LODs.Length; i++) { tilingScheme.LODs[i] = new LODInfo() { Resolution = resolution, LevelID = i, Scale = scale }; resolution /= 2; scale /= 2; } sb = new StringBuilder("\r\n"); foreach (LODInfo lod in tilingScheme.LODs) { sb.Append(@" {""level"":" + lod.LevelID + "," + @"""resolution"":" + lod.Resolution + "," + @"""scale"":" + lod.Scale + @"}," + "\r\n"); } tilingScheme.LODsJson = sb.ToString().Remove(sb.ToString().Length - 3);//remove last "," and "\r\n" //two extent tilingScheme.InitialExtent = new Envelope(-cornerCoordinate, -cornerCoordinate, cornerCoordinate, cornerCoordinate); tilingScheme.FullExtent = tilingScheme.InitialExtent; tilingScheme.PacketSize = 128; tilingScheme.StorageFormat = StorageFormat.esriMapCacheStorageModeExploded; tilingScheme.TileCols = tilingScheme.TileRows = 256; tilingScheme.TileOrigin = new Point(-cornerCoordinate, cornerCoordinate); tilingScheme.WKID = 3857;//102100; tilingScheme.WKT = @"PROJCS[""WGS_1984_Web_Mercator_Auxiliary_Sphere"",GEOGCS[""GCS_WGS_1984"",DATUM[""D_WGS_1984"",SPHEROID[""WGS_1984"",6378137.0,298.257223563]],PRIMEM[""Greenwich"",0.0],UNIT[""Degree"",0.0174532925199433]],PROJECTION[""Mercator_Auxiliary_Sphere""],PARAMETER[""False_Easting"",0.0],PARAMETER[""False_Northing"",0.0],PARAMETER[""Central_Meridian"",0.0],PARAMETER[""Standard_Parallel_1"",0.0],PARAMETER[""Auxiliary_Sphere_Type"",0.0],UNIT[""Meter"",1.0],AUTHORITY[""ESRI"",""3857""]]"; return(tilingScheme); }
protected override void ReadSqliteTilingScheme(out TilingScheme tilingScheme, SQLiteConnection sqlConn) { tilingScheme = new TilingScheme(); StringBuilder sb; #region read MBTile tiling scheme tilingScheme.Path = "N/A"; tilingScheme.CacheTileFormat = ImageFormat.PNG; //two extent if (serviceType == DataSourceType.STATIC) { using (SQLiteCommand sqlCmd = new SQLiteCommand(sqlConn)) { sqlCmd.CommandText = string.Format("SELECT value FROM metadata WHERE name='bounds'"); //will raise exception if metadata table not exists object o = sqlCmd.ExecuteScalar(); //null can not directly convert to byte[], if so, will return "buffer can not be null" exception if (o != null) { string[] bounds = o.ToString().Split(new char[] { ',' }); double xmin = double.Parse(bounds[0]); double ymin = double.Parse(bounds[1]); double xmax = double.Parse(bounds[2]); double ymax = double.Parse(bounds[3]); Util.Point pLeftTop = Utility.GeographicToWebMercator(new Util.Point(xmin, ymax)); Util.Point pRightBottom = Utility.GeographicToWebMercator(new Util.Point(xmax, ymin)); tilingScheme = SchemaProvider.Inst.getSchema("BaiDuOnline", null, null); tilingScheme.InitialExtent = new Envelope(pLeftTop.X, pRightBottom.Y, pRightBottom.X, pLeftTop.Y); } else { throw new Exception(); } } } else { tilingScheme = BaiDuMapManager.inst.getBaiDuSchema(-180, 180, 85, -85); } #endregion }
protected override void ReadTilingScheme(out TilingScheme tilingScheme) { //validate MBTile tile field if (serviceType == DataSourceType.STATIC) { using (SQLiteCommand sqlCmd = new SQLiteCommand("SELECT tile_data FROM tiles", _sqlConn)) { try { object o = sqlCmd.ExecuteScalar(); } catch (Exception e) { throw new Exception("Selected file is not a valid MBTile file\r\n" + e.Message); } } } ReadSqliteTilingScheme(out tilingScheme, _sqlConn); this.TilingScheme = TilingSchemePostProcess(tilingScheme);; }
public TilingScheme Get(string dataSourceName) { TilingScheme result; string key = dataSourceName == null ? "default" : dataSourceName; if (!_STSchemas.ContainsKey(key)) { result = null; } else { TilingScheme temp = _STSchemas[key]; result = new TilingScheme(); result.CacheTileFormat = temp.CacheTileFormat; result.CompressionQuality = temp.CompressionQuality; result.DPI = temp.DPI; result.FullExtent = temp.FullExtent; result.InitialExtent = new Util.Envelope() { XMin = temp.InitialExtent.XMin, XMax = temp.InitialExtent.XMax, YMin = temp.InitialExtent.YMin, YMax = temp.InitialExtent.YMax }; result.LODs = temp.LODs; result.LODsJson = temp.LODsJson; result.PacketSize = temp.PacketSize; result.Path = temp.Path; result.RestResponseArcGISJson = temp.RestResponseArcGISJson; result.RestResponseArcGISPJson = temp.RestResponseArcGISPJson; result.StorageFormat = temp.StorageFormat; result.TileCols = temp.TileCols; result.TileOrigin = temp.TileOrigin; result.TileRows = temp.TileRows; result.WKID = temp.WKID; result.WKT = temp.WKT; } return(result); }
protected void ReadOtherMapTilingScheme(out TilingScheme tilingScheme) { tilingScheme = SchemaProvider.Inst.getSchema("OtherMap", this.Type, "default"); }
protected override void ReadTilingScheme(out TilingScheme tilingScheme) { ReadOtherMapTilingScheme(out tilingScheme); this.TilingScheme = TilingSchemePostProcess(tilingScheme); }
private void StartButtonClicked(object parameters) { if (!IsValidFilename(Output)) { MessageBox.Show(App.Current.FindResource("msgOutputPathError").ToString(), App.Current.FindResource("msgError").ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (File.Exists(Output)) { if (MessageBox.Show(App.Current.FindResource("msgOverwrite").ToString(), App.Current.FindResource("msgWarning").ToString(), MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { return; } else { try { File.Delete(Output); } catch (Exception e) { MessageBox.Show(e.Message, App.Current.FindResource("msgError").ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } } try { TilingScheme tilingScheme = PBS.Service.SchemaProvider.Inst.getSchema("OtherMap", null, null); var lods = tilingScheme.LODs; int[] Levels = new int[lods.Count()]; int i = 0; foreach (var lod in lods) { Levels[i] = lod.LevelID; i++; } PBS.Util.Envelope g = PBS.Service.SchemaProvider.Inst.getDownloadExtend("OtherMap"); string fileDest = Output; Datasource = new DataSourceOtherMap("", true) { OutputFileName = Output, downloadExtent = g }; Datasource.ConvertCompleted += (s, a) => { if (a.Successful) { string str = App.Current.FindResource("msgConvertComplete").ToString(); if (DoCompact) { str += "\r\n" + App.Current.FindResource("msgCompactResult").ToString() + (Datasource.ConvertingStatus.SizeBeforeCompact / 1024).ToString("N0") + "KB --> " + (Datasource.ConvertingStatus.SizeAfterCompact / 1024).ToString("N0") + "KB"; } MessageBox.Show(str, "", MessageBoxButtons.OK, MessageBoxIcon.Information); } }; // Datasource.ConvertCancelled += (s, a) => //{ //}; BackgroundWorker bw = new BackgroundWorker(); bw.DoWork += (s, a) => { IsIdle = false; try { Datasource.ConvertToMBTiles(fileDest, "", "", "", Levels, g, false); } catch (Exception e) { MessageBox.Show(e.Message, App.Current.FindResource("msgError").ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error); } IsIdle = true; }; bw.RunWorkerAsync(); } catch (Exception e) { MessageBox.Show(e.Message); } }
protected override void ReadTilingScheme(out TilingScheme schema) { schema = SchemaProvider.Inst.getSchema("OtherMap", null, null); //schema.InitialExtent = Utility.GPSToWebMercator(schema.InitialExtent); schema = TilingSchemePostProcess(schema); }
protected override void ReadTilingScheme(out TilingScheme tilingScheme) { tilingScheme = SchemaProvider.Inst.getSchema("OtherMap", this.subType, "default"); this.TilingScheme = TilingSchemePostProcess(tilingScheme); }
protected void ReadBaiduTilingScheme(out TilingScheme tilingScheme) { tilingScheme = SchemaProvider.Inst.getSchema("BaiDuOnline", null, null); }
protected override void ReadTilingScheme(out TilingScheme tilingScheme) { ReadArcGISTiledMapServiceTilingScheme(_serviceInfoHashtable, out tilingScheme); this.TilingScheme = TilingSchemePostProcess(tilingScheme); }
public void ReadTilingScheme() { string configName = AppDomain.CurrentDomain.BaseDirectory + "CustomTile.xml"; if (!File.Exists(configName)) { throw new FileNotFoundException(configName + " does not exist!"); } XDocument xDoc = XDocument.Load(configName); XElement schemaElement = xDoc.Element("Services"); foreach (XElement se in schemaElement.Elements()) { string type = se.Attribute("type").Value; string subType = se.Attribute("subType").Value; string name = se.Attribute("name").Value; var lods = from map in se.Descendants("Lods").Elements() select new { Level = map.Attribute("level").Value, Resolution = map.Attribute("resolution").Value, Scale = map.Attribute("scale").Value }; TilingScheme tilingScheme = new TilingScheme(); StringBuilder sb; tilingScheme.Path = "N/A"; tilingScheme.CacheTileFormat = PBS.DataSource.ImageFormat.PNG; tilingScheme.CompressionQuality = 75; tilingScheme.DPI = Convert.ToInt32(se.Element("Dpi").Attribute("value").Value); tilingScheme.LODs = new LODInfo[lods.Count()]; sb = new StringBuilder("\r\n"); int i = 0; foreach (var lod in lods) { int levelId = Convert.ToInt32(lod.Level); tilingScheme.LODs[i] = new LODInfo() { LevelID = levelId, Resolution = Convert.ToDouble(lod.Resolution), Scale = Convert.ToDouble(lod.Scale) }; sb.Append(@" {""level"":" + lod.Level + "," + @"""resolution"":" + lod.Resolution + "," + @"""scale"":" + lod.Scale + @"}," + "\r\n"); i++; } tilingScheme.LODsJson = sb.ToString().Remove(sb.ToString().Length - 3);//remove last "," and "\r\n" //two extent tilingScheme.InitialExtent = new PBS.Util.Envelope(Convert.ToDouble(se.Element("InitialExtent").Attribute("xmin").Value), Convert.ToDouble(se.Element("InitialExtent").Attribute("ymin").Value) , Convert.ToDouble(se.Element("InitialExtent").Attribute("xmax").Value), Convert.ToDouble(se.Element("InitialExtent").Attribute("ymax").Value)); tilingScheme.FullExtent = new PBS.Util.Envelope(Convert.ToDouble(se.Element("FullExtent").Attribute("xmin").Value), Convert.ToDouble(se.Element("FullExtent").Attribute("ymin").Value) , Convert.ToDouble(se.Element("FullExtent").Attribute("xmax").Value), Convert.ToDouble(se.Element("FullExtent").Attribute("ymax").Value)); tilingScheme.PacketSize = 128; tilingScheme.StorageFormat = StorageFormat.esriMapCacheStorageModeExploded; tilingScheme.TileRows = Convert.ToInt32(se.Element("Rows").Attribute("value").Value); tilingScheme.TileCols = Convert.ToInt32(se.Element("Cols").Attribute("value").Value); tilingScheme.TileOrigin = new PBS.Util.Point(Convert.ToDouble(se.Element("Origin").Attribute("x").Value), Convert.ToDouble(se.Element("Origin").Attribute("y").Value)); tilingScheme.WKID = Convert.ToInt32(se.Element("SpatialReference").Attribute("wkid").Value); tilingScheme.WKT = @"PROJCS[""WGS_1984_Web_Mercator_Auxiliary_Sphere"",GEOGCS[""GCS_WGS_1984"",DATUM[""D_WGS_1984"",SPHEROID[""WGS_1984"",6378137.0,298.257223563]],PRIMEM[""Greenwich"",0.0],UNIT[""Degree"",0.0174532925199433]],PROJECTION[""Mercator_Auxiliary_Sphere""],PARAMETER[""False_Easting"",0.0],PARAMETER[""False_Northing"",0.0],PARAMETER[""Central_Meridian"",0.0],PARAMETER[""Standard_Parallel_1"",0.0],PARAMETER[""Auxiliary_Sphere_Type"",0.0],UNIT[""Meter"",1.0],AUTHORITY[""ESRI"",""3857""]]"; addSchema(type, subType, name, tilingScheme); string configPath = se.Element("MainTypeUrlConfig").Attribute("path").Value; setConfigPath(type, configPath); string downloadUrl = se.Element("MapUrl").Attribute("value").Value; SetDownloadUrl(type, subType, name, downloadUrl); PBS.Util.Envelope downLoadExtent = new PBS.Util.Envelope(Convert.ToDouble(se.Element("DownLoadExtent").Attribute("xmin").Value), Convert.ToDouble(se.Element("DownLoadExtent").Attribute("ymin").Value), Convert.ToDouble(se.Element("DownLoadExtent").Attribute("xmax").Value), Convert.ToDouble(se.Element("DownLoadExtent").Attribute("ymax").Value)); setDownloadExtend(type, downLoadExtent); } }
public void Add(string dataSourceName, TilingScheme schema) { string key = dataSourceName == null ? "default" : dataSourceName; _STSchemas.Add(dataSourceName, schema); }
private BdCoodOffsetProvider() { baiduSchema = BaiDuMapManager.inst.getBaiDuSchema(); inst = this; }
protected override void ReadTilingScheme(out TilingScheme tilingScheme) { ReadArcGISTilingSchemeFile(this.Path, out tilingScheme); this.TilingScheme = TilingSchemePostProcess(tilingScheme); }
public void addSchema(string dataSourceType, string dataSourceSubType, string dataSourceName, TilingScheme schema) { string key = dataSourceType == null ? "default" : dataSourceType; SameTypeSchemas s1; if (!schemas.ContainsKey(key)) { s1 = new SameTypeSchemas(); schemas.Add(key, s1); } else { s1 = schemas[key]; } s1.Add(dataSourceSubType, dataSourceName, schema); }