Ever wondered how geospatial data works? Why don’t you come along and learn it where you’ll be presented to a fully functioning geospatial application that uses metadata from images to pinpoint them to a map. You’ll be introduced to a NoSQL tool and you’ll learn the basics of NoSQL technologies in a fun and initiative way. Along the way you’ll experience geospatial data, full stack application development using JavaScript and a little bit on semantic data as well. You will experience how easy it is to manage hybrid data (JSON documents, JPEG images as well as RDF triples) in one database, how to query geospatial data and how to work with JavaScript across a three tiered application.
6. <html>
<body>
<script src="jquery.js"></script>
<script>
$.ajax({ url: "/items" }).done(function(html) {
$("#results").append(html);
});
</script>
</body>
</html>
AJAX & jQuery era
● Asynchronous requests to websites
● Page updates & data loads, without the need to reload the site
● First real step towards interactive websites
8. var http = require('http');
var server = http.createServer(function(request, response) {
response.writeHead(200, {
'Content-type': 'text/plain'
});
response.write('hello node');
response.end();
});
server.listen(8080);
JavaScript at the server-side
● Ubiquity in the browser had trickled down the stack
● You can run JavaScript at the server-side
● It’s fast - asynchronous & non-blocking
18. var latitude = 10.3910;
var longitude = -75.4794;
var miles = function(distance) { return distance * 1.60934 };
cts.search(cts.jsonPropertyChildGeospatialQuery('location',
'coordinates',
cts.circle(miles(5), cts.point(latitude, longitude))
));
Server-side JavaScript in MarkLogic
● Runs on Google’s V8 engine (JavaScript compiler)
● Allows you to execute JavaScript code close to your data (“stored procedures”)
○ both native JavaScript (including some ES2015) and proprietary JavaScript
19. var marklogic = require('marklogic');
var db = marklogic.createDatabaseClient
(connection);
var qb = marklogic.queryBuilder;
db.documents.query(
qb.where(
qb.geospatial(
qb.geoProperty(
qb.property('location'),
qb.property('coordinates')),
qb.circle(10, 10.3910, -75.4794)
)
)
).result().then(function(response) {
console.log(response);
});
Node.js Client API
● Registered npm package
● Focus on application
features rather than
plumbing:
○ read/write (bulk), patch
(updates), queries,
projections, extensions,
alerting, semantics …
● Supports all geospatial
query types