The data stored in my Database "video" of "shows" collection in mongodb is as this. It has 3 feilds as dose_rate, x, y.

My code for "app.js" is as follows :

var express=require('express');
var MongoClient=require('mongodb').MongoClient;
var engines=require('consolidate');
var assert=require('assert');
var app=express();

app.engine('html',engines.nunjucks);
app.set('view engine','html');
app.set('views',__dirname+ '/views');

MongoClient.connect('mongodb://localhost:27017/video',function(err,db){
assert.equal(null,err);
console.log("successfully connect to the MongoDB server");
app.get('/',function(req,res){
    db.collection('shows').find({}).toArray(function(err,docs){
        res.render('shows',{'shows':docs});
        });
      });
    });
 });

app.listen(4596,function(req,res){
console.log("connect to the port 4596");
});

the below code is for "shows.html" :

<!DOCTYPE html>
 <html>

<head>
<title>Plotting points</title>
</head>

<body>
<ul class="nav navbar-nav">
{%for show in shows%}
<li>{{show.dose_rate}}</li>
<li> {{show.x}}</li>
<li>{{show.y}}</li>
{%endfor%}
</ul>
</body>
</html>

on running the code of "app.js" and on opening "shows.html" from browser on localhost, the output is that all points (i.e dose_rate, x, y) of my "shows" collection in "video" database is displayed on HTML page as this.

now i did get code for plotting a point on OSM as marker from this link--> wiki.openstreetmap.org/wiki/OpenLayers_Simple_Example independently without app.js running in background as simple HTML page.

I want to plot all my points stored in my collection "shows" as "x" and "y" from that db on OSM map, one by one, at once. I tried finding all reference to this problem but failed to find one. Please help me in doing so as i am new to OSM and nodejs or post any reference which i can read or tag someone who can help. THANK YOU IN ADVANCE

asked 15 Feb '17, 06:19

pnnp's gravatar image

pnnp
11112
accept rate: 0%

Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×511
×68
×46
×14
×5

question asked: 15 Feb '17, 06:19

question was seen: 1,328 times

last updated: 15 Feb '17, 06:19

powered by OSQA