GithubHelp home page GithubHelp logo

echosystemmark / elasticmaps Goto Github PK

View Code? Open in Web Editor NEW

This project forked from inaturalist/elasticmaps

0.0 0.0 0.0 769 KB

Map tileserver based on node-mapnik and elasticsearch

JavaScript 100.00%

elasticmaps's Introduction

Elasticmaps

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 );
});

elasticmaps's People

Contributors

pleary avatar dependabot[bot] avatar kueda avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.