Cartagen Wiki
Redirecting To Cartagen Planet Server

Say you’re running an instance of Cartagen Server, or even just a copy of Cartagen Client, but you want access to the full map data for the planet (provided by OpenStreetMap). But you don’t want to run a Planet server!

First, you’ll static_map to false in your html:

<script charset='utf-8' type='text/javascript'> Cartagen.setup({ stylesheet: "/static/rome/style.gss", static_map: false, static_map_layers: ["more.json"], lat: 41.891, lng: 12.4902, // debug: true }) </script>

Now your map will generate requests to your server at the address:

/api/0.6/geohash/xxxxxx.json

To accomplish that, uncomment the following lines from /app/controllers/api_controller.rb:

    url = URI.parse('http://cartagen.org/api/0.6/geohash/'+params[:id]+'.json')
    req = Net::HTTP::Get.new(url.path)
    res = Net::HTTP.start(url.host, url.port) {|http|
      http.request(req)
    }
    render :text => res.body

.htaccess redirecting

For higher performance, you can redirect requests to your Cartagen Server instance’s /api/0.6/ directory with a .htaccess file containing the following lines:

Redirect 301 /api/0.6/(.*) http://cartagen.org/api/0.6/$1

For a *NIX server, especially Mac OS X, you have to make sure .htaccess redirects are working by modifying the httpd.conf file:

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride All

And the users/username.conf file:

<Directory "/Users/your_username/Sites/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>