0.2.2 • Published 7 years ago

elasticmaps v0.2.2

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

Elasticmaps

npm version Build Status Coverage Status

A Node.js map tile server based on node-mapnik and elasticsearch

Installation

npm install elasticmaps --save

Usage

// This is the most basic example. It assumes elasticsearch
// is running on localhost:9200, and that there is an index
// named elasticmaps_development which has documents with minimally
// an integer `id` and geo_point `location` field

var Elasticmaps = require( "elasticmaps" ),
    port = Number( process.env.PORT || 4000 );

var app = Elasticmaps.server( );
// create the tile route
app.get( "/:style/:zoom/:x/:y.:format([a-z\.]+)", Elasticmaps.route );

app.listen( port, function( ) {
  console.log( "Listening on " + port );
});

// In this example a custom config object is supplied
// when creating the server. Functions can be provided
// to create custom queries and styles based on the request

var Elasticmaps = require( "elasticmaps" ),
    port = Number( process.env.PORT || 4000 );

var config =  {
  environment: "production",
  debug: true,
  tileSize: 256,
  elasticsearch: {
    host: "localhost:9200",
    searchIndex: "points_index",
    geoPointField: "location"
  },
  prepareQuery: function( req, callback ) {
    req.elastic_query = ...;
    callback( null, req );
  },
  prepareStyle: function( req, callback ) {
    req.style = ...;
    callback( null, req );
  }
};

var server = Elasticmaps.server( config );
server.listen( port, function( ) {
  console.log( "Listening on " + port );
});
0.2.2

7 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.13

8 years ago

0.1.12

8 years ago

0.1.11

9 years ago

0.1.10

9 years ago

0.1.9

9 years ago

0.1.8

9 years ago

0.1.7

9 years ago

0.1.6

9 years ago

0.1.5

9 years ago

0.1.4

9 years ago

0.1.3

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago