This project has moved. For the latest updates, please go here.

TIle Layers without connection to internet

Topics: SharpMap Project, SharpMap v2.0, WinForms Controls
Nov 22, 2012 at 10:08 AM


Big thanks to the developers of the project!

I have several questions:

1. Can TileSource work without an internet connection? To download my map to a local drive?

2. Can I extend TileSource what any other maps? Such as Ovi or Yahoo?

WinFormSamples very much, but unfortunately, almost everything works only with connection to the Internet.

I would be grateful for any help and support! Thank you!

Nov 22, 2012 at 11:21 AM
  1. Yes it can. You may need to compile BruTile yourself to make it work, though.

    You can either use FileTileProvider, a provider that takes the tiles from a directory or the MbTilesProvider, a provider that takes the tiles from an SQLite database that adheres to the MBTiles specification. See the current latest code on
  2. Sure you can, it is certainly appreciated. Please post patchfiles/source code to

Hth FObermaier

Nov 22, 2012 at 12:22 PM

Thank you very much! ^_^

Nov 22, 2012 at 12:43 PM

One question: You say "tiles from a directory"... I don't have tiles GoogleMaps, OpenStreet and Bing :( 

Where can I get them? Sorry for the stupid questions.

Nov 23, 2012 at 6:54 AM

You have several possibilities

  • You need to setup your TileLayer with a FileCache and (in an online session) browse your whole area of interest in every desired zoomlevel.
  • Use TileMill to genereate your tiles
  • Download mbtiles from MapBox
  • Create your tiles from some geotiff using MapTiler
  • ...
Nov 26, 2012 at 5:08 AM

thank you very much!!! :)

Apr 9, 2013 at 1:00 PM
Hi fobermaier,
How to load tiles(which are on disk) using Filetileprovider.
Please explain me with example
May 20, 2013 at 6:24 PM
Edited May 20, 2013 at 6:44 PM
Jun 3, 2013 at 4:07 PM
Good afternoon, everybody. Someone's got to solve this problem? I want to use OSM maps offline?
It is even possible to simplify the problem by using local maps .osm or .PBF. Please help. I can not solve this problem for 2 months...
Jun 3, 2013 at 10:48 PM
Yes absolutely,

What platform?
  • What Language?
Jun 4, 2013 at 10:30 AM
Edited Jun 4, 2013 at 10:40 AM
OS: Windows
Language: C# MSVS2010
Jun 4, 2013 at 12:58 PM
Edited Jun 4, 2013 at 12:58 PM
Yes absolutely,

Just follow the instruction there to generate your tiles, this solution does not provide a control to render your tiles, your gonna have to find the control that fits your needs.

This solution is for linux, but I have tested it on Windows, C#, VS2010 and it works.

Jun 13, 2013 at 9:12 AM
Edited Jun 13, 2013 at 9:14 AM
C:\Program Files\HOTOSM\bin>osm2pgsql RU-PER.osm.bz2 -H localhost -d osm -p osm

-U postgres -P 5432 -W -S -C 512 -s -l
osm2pgsql SVN version 0.69-21289M

Using projection SRS 4326 (Latlong)
Setting up table: osm_point
Setting up table: osm_line
Setting up table: osm_polygon
Setting up table: osm_roads
Mid: pgsql, scale=10000000, cache=512MB, maxblocks=65537*8192
Setting up table: osm_nodes
*** WARNING: intarray contrib module not installed
*** The resulting database will not be usable for applying diffs.
Setting up table: osm_ways
Setting up table: osm_rels

!! You are running this on 32bit system, so at most
!! 3GB of RAM can be used. If you encounter unexpected
!! exceptions during import, you should try running in slim
!! mode using parameter -s.

Reading in file: RU-PER.osm.bz2
Processing: Node(3750k) Way(85k) Relation(0k)COPY_END for COPY osm_nodes FROM ST
failed: ОШИБКА: повторяющееся значение ключа нарушает ограничение уникальности
DETAIL: Ключ "(id)=(2147483647)" уже существует.
CONTEXT: COPY osm_nodes, строка 3599746: "2147483647 583142904 56835881
2 \N"

Error occurred, cleaning up
DETAIL: Key "(id)=(2147483647)" already exist.

I had such a problem. I think this is due to the fact that the field is 32 bits, respectively, I reach the upper limit of the index field. The database I can not find the table to change the type of the field to an unsigned. Give advice please
Jun 13, 2013 at 1:06 PM
I don't see where osm_node_pkey is. Can you tell me where it is?

When I look at all the planet_osm_* tables created, I see
CREATE TABLE planet_osm_point
osm_id bigint,

If the (id) in the detail message is "osm_id", the limit should be fine:

Maybe your .bz2 file is the problem. Have you tried with the massachusset file given in the example above?