Run WebGL Earth Locally (OSM)

743 views
Skip to first unread message

chris

unread,
May 22, 2012, 8:52:14 AM5/22/12
to webgl...@googlegroups.com

I am using WebGL Earth's api to locally run an instance of it on my Tomcat box using OSM. However after my internet cut out on me I realized I wasnt entirely running locally as the api.js seems to be calling tile.openstreetmap.org for its tiles.

I have downloaded and begun playing with JTileDownloader with hopes of downloading all OSM tiles so that I can truly run WebGL Earth locally, but before I go too far, has anyone ever run WebGL Earth with OSM locally using only their container? Is there an easier way to do this (getting all tiles locally and pointing api.js to them) ?

Petr Sloup - Klokan Technologies GmbH

unread,
May 22, 2012, 12:28:36 PM5/22/12
to webgl...@googlegroups.com
Hi,

it is quite easy. You just have to define your own tileprovider using the api.


var customTMS = earth.initMap(WebGLEarth.Maps.CUSTOM, ['TMS','http://data.webglearth.com/natural-earth-color/{z}/{x}/{y}.jpg',1,5,256,true]);
// name, url, minZoom, maxZoom, tileSize, flip-y-axis
earth.setBaseMap(customTMS);

All you need to do is modify the data url to point to your local files. The parameters are described in the comment.

Regards,
Petr

chris

unread,
May 22, 2012, 2:01:24 PM5/22/12
to webgl...@googlegroups.com
Thank you for your response Petr!
That answers the second part of my question, however do you know how I can download all of the OSM tiles so that I dont have to go to tiles.openstreetmap.org? Is there a .zip or .gz of all OSM tiles somewhere? Many thanks!
Respectfully,
Chris

Petr Sloup - Klokan Technologies GmbH

unread,
May 22, 2012, 2:47:29 PM5/22/12
to webgl...@googlegroups.com
I don't think the tiles are available in any .zip or .gz or anything like that. If you are planning on bulk downloading the tiles from the web, be sure to read  http://wiki.openstreetmap.org/wiki/Tile_usage_policy#Bulk_Downloading first, because it may be forbidden to do so.

chris

unread,
May 22, 2012, 3:17:33 PM5/22/12
to webgl...@googlegroups.com
okay, thank you very much Petr!

Klokan Petr Přidal

unread,
May 22, 2012, 3:45:11 PM5/22/12
to webgl...@googlegroups.com
Chris,

I would add that:

- From a raster image you can easily generate tiles yourself - with
our open-source GDAL2Tiles/MapTiler or our MapTiler Cluster.
Online are data you can use for free, such as the Natural Earth
(http://www.naturalearthdata.com/) or NASA BlueMarble
(http://visibleearth.nasa.gov/view_cat.php?categoryID=1484)

- We did such a rendering and prepared already an offline version of
WebGL Earth. You can get the tiles from:
http://code.google.com/p/webglearth/source/browse/resources/tms/ (SVN
checkout will do the work too).
The code of the demo is: http://data.webglearth.com/examples/custommap.html
You can simply download the api.js and place it on your computer, it
is standalone.
It could even all run from a local directory - from a USB stick for
example, while offline.

- If you want OpenStreetMap - the easiest is to use MapBox tiles -
such as the World Bright map type at:
http://data.webglearth.com/#ll=32.69258,11.65181;alt=4591366;h=-0.058;t=0.304
These tiles were freely available for download - I can give you a link
to our server.

- If you want deeper zoom levels for your maps - you can render it
yourself with tools like Mapnik - from vector data.
In fact tools such as http://mapbox.com/tilemill/ are making it easier.
It is also not that hard to configure dynamic installation of your own
OSM server - which would then run offline or behind a firewall and
generate the tiles on demand. Check http://tiledrawer.com/ (a ready to
use virtual machine on Amazon EC2) or one of the online tutorials such
as http://en.flossmanuals.net/openstreetmap/setting-up-your-own-tile-server/.

Best regards,

Petr Pridal alias Klokan
--
http://blog.klokan.cz/
http://www.maptiler.org/
http://www.oldmapsonline.org/

chris

unread,
May 22, 2012, 5:48:27 PM5/22/12
to webgl...@googlegroups.com
Petr,
I cannot say thank you enough for your time with this last post. There is a lot for me to learn here, and I cannot wait to research each link to better understand all of this. Many thanks for the lesson!

Respectfully,
Chris

On Tuesday, May 22, 2012 8:52:14 AM UTC-4, chris wrote:

Lijie

unread,
May 22, 2012, 9:58:30 PM5/22/12
to webglearth
Hi petri
 
I have two questions:
 
the first one is how to compiled with WebGL Earth codebase,i have already follow the steps at the Quickstart for developers,but my pc(win7) told me Is not an internal or external command,it's the problem of the python????can u give me a exemple???
 
the last one is can i use API to add a weapp-zoomslider???if the earth is terrain,what can i do???
 
 
sorry for a lot of questions,best regard
 
 
jie
 

Date: Tue, 22 May 2012 09:28:36 -0700
From: slou...@gmail.com
To: webgl...@googlegroups.com
Subject: [webglearth] Re: Run WebGL Earth Locally (OSM)

Petr Pridal

unread,
Dec 18, 2014, 3:07:28 AM12/18/14
to webgl...@googlegroups.com
The offline use example with WebGL Earth2 is available at:

Reply all
Reply to author
Forward
0 new messages