Tài liệu Getting Started with GEO, CouchDB, and Node.js pdf

66 2.2K 1
Tài liệu Getting Started with GEO, CouchDB, and Node.js pdf

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

www.it-ebooks.info www.it-ebooks.info ©2011 O’Reilly Media, Inc. O’Reilly logo is a registered trademark of O’Reilly Media, Inc. Learn how to turn data into decisions. From startups to the Fortune 500, smart companies are betting on data-driven insight, seizing the opportunities that are emerging from the convergence of four powerful trends: n New methods of collecting, managing, and analyzing data n Cloud computing that oers inexpensive storage and exible, on-demand computing power for massive data sets n Visualization techniques that turn complex data into images that tell a compelling story n Tools that make the power of data available to anyone Get control over big data and turn it into insight with O’Reilly’s Strata offerings. Find the inspiration and information to create new products or revive existing ones, understand customer behavior, and get the data edge. Visit oreilly.com/data to learn more. www.it-ebooks.info www.it-ebooks.info Getting Started with GEO, CouchDB, and Node.js www.it-ebooks.info www.it-ebooks.info Getting Started with GEO, CouchDB, and Node.js Mick Thompson Beijing • Cambridge • Farnham • Köln • Sebastopol • Tokyo www.it-ebooks.info Getting Started with GEO, CouchDB, and Node.js by Mick Thompson Copyright © 2011 David M. Thompson. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://my.safaribooksonline.com). For more information, contact our corporate/institutional sales department: (800) 998-9938 or corporate@oreilly.com. Editors: Mike Hendrickson and Julie Steele Production Editor: Kristen Borg Proofreader: O’Reilly Production Services Cover Designer: Karen Montgomery Interior Designer: David Futato Illustrator: Robert Romano Printing History: July 2011: First Edition. Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc. Getting Started with GEO, CouchDB, and Node.js, the image of a fifteen-spined stickleback, and related trade dress are trademarks of O’Reilly Media, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a trademark claim, the designations have been printed in caps or initial caps. While every precaution has been taken in the preparation of this book, the publisher and authors assume no responsibility for errors or omissions, or for damages resulting from the use of the information con- tained herein. ISBN: 978-1-449-30752-3 [LSI] 1311082908 www.it-ebooks.info Table of Contents Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii 1. Node.js . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Getting Started with Node.js 1 Asynchronous Callbacks 2 Using Node.js on the Web 4 ExpressJS 4 2. Geographic Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Geo Datasets 7 GeoJSON 8 Example Geometries 8 GDAL 9 Installing 9 Grab Some Data 9 Ogrinfo 10 Ogr2ogr 11 Geohash 11 3. CouchDB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 How Does CouchDB Work? 15 Replication 15 Indexes and Views 16 Getting Started with CouchDB 16 Creating a Database 16 Creating a View 17 View Options 19 Using Reduce 20 Using CouchApps…For Fun and Profit 21 Load Shared Code 22 GeoCouch 24 v www.it-ebooks.info Importing Data 25 Using Cradle to Talk to Geocouch 25 Bounding Box Queries 27 Displaying the Data Using Node.js 28 CouchDB Hosting Options 31 4. MapChat - Example Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 Realtime Chat 33 Socket.io 33 Setting Up the Project 34 Using Google Maps 38 Getting User Location 39 Custom Overlays 40 Chat Messages from CouchDB 43 Clustering 45 Using a List Function 45 Notify Clients of Cluster Updates 46 Display List of Clusters in the Client 47 vi | Table of Contents www.it-ebooks.info [...]... developer The first thing to keep in mind when getting started with asynchronous development is that execution might not follow the same squence every time Getting Started with Node.js In order to install Node.js, download the source and build it The main Node.js web page at http://nodejs.org can be very helpful in linking to downloads, source code repositories, and documentation The master branch of the... the title, author, publisher, and ISBN For example: Getting Started with GEO, CouchDB, and Node.js by Mick Thompson (O’Reilly) Copyright 2011 David Thompson, 978-1-449-30752-3.” If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at permissions@oreilly.com Safari® Books Online Safari Books Online is an on-demand digital library that lets... messy to work with, as they require synchronizing or locking in order to manipulate shared memory safely The forced Asnychronous IO of Node.js gives a clean way to accomplish parallel tasks Getting Started with Node.js | 3 www.it-ebooks.info Using Node.js on the Web One of the many uses of Node.js is to serve up dynamic content over HTTP: that is to say, websites Again another advanage of Node.js s Asynchronous... over 7,500 technology and creative reference books and videos to find the answers you need quickly With a subscription, you can read any page and watch any video from our library online Read books on your cell phone and mobile devices Access new titles before they are available for print, and get exclusive access to manuscripts in development and post feedback for the authors Copy and paste code samples,... ExpressJS handles many other aspects of running a HTTP server, including session support, routing middleware, cookie parsing, and many other things The full documentation for ExpressJS is provided at http://expressjs.com/guide.html Node.js with its powerful asynchronous IO, common and simple syntax, and many useful modules in active development is a great choice for building web applications Using Node.js. .. CouchDB automatically when views are requested Getting Started with CouchDB The easiest way to get started using CouchDB for development is by downloading and installing a build of Couchbase Builds are available for most major operating systems at http://www.couchbase.com/downloads Couchbase is a company that combines the power and utility of CouchDB with Membase Several of the core committers to the... find Developing using open source tools such as Node.js and CouchDB has recently made working with location data simple and fast Conventions Used in This Book The following typographical conventions are used in this book: Italic Indicates new terms, URLs, email addresses, filenames, and file extensions Constant width Used for program listings, as well as within paragraphs to refer to program elements... www.it-ebooks.info www.it-ebooks.info CHAPTER 1 Node.js Node.js has quickly become a very popular asynchronous framework for JavaScript It is built on top of the same V8 engine that the Chromium and Google Chrome web browsers use to interpret JavaScript With the addition of networking and file system API support, it has quickly proved to be a capable tool for interacting with IO in a asynchronous way There are... "_id": "618f6d552f8cf3061934a4d08700089a", "_rev": "1-a9f8690408bbffaf3389dc1aa5ecd79c", "name": "John", "age": 23, "gender": "male" } } ] } Getting Started with CouchDB | 19 www.it-ebooks.info Using these simple limit and skip parameters, combined with offset and total_row properties of the returned JSON response, it is super easy to set up paging for a set of rows in a view A full list of parameters... most recent tagged version For example: v0.4.9 The Node.js package manager or NPM is an extremely useful tool It can handle installing, updating, and removing packages and their dependencies Creating packages is also simple since the configuration for the package is contained in the package.json file Installation instructions for NPM are included in the Node.js repository 1 www.it-ebooks.info Asynchronous . more. www.it-ebooks.info www.it-ebooks.info Getting Started with GEO, CouchDB, and Node. js www.it-ebooks.info www.it-ebooks.info Getting Started with GEO, CouchDB, and Node. js Mick Thompson Beijing • Cambridge • Farnham • Köln • Sebastopol • Tokyo www.it-ebooks.info Getting. Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc. Getting Started with GEO, CouchDB, and Node. js,

Ngày đăng: 17/02/2014, 11:20

Từ khóa liên quan

Mục lục

  • Table of Contents

  • Preface

    • Conventions Used in This Book

    • Using Code Examples

    • Safari® Books Online

    • How to Contact Us

    • Chapter 1. Node.js

      • Getting Started with Node.js

        • Asynchronous Callbacks

        • Using Node.js on the Web

          • ExpressJS

            • Routes

            • Templates

            • Static Files

            • Chapter 2. Geographic Data

              • Geo Datasets

              • GeoJSON

                • Example Geometries

                • GDAL

                  • Installing

                  • Grab Some Data

                  • Ogrinfo

                  • Ogr2ogr

                  • Geohash

                  • Chapter 3. CouchDB

                    • How Does CouchDB Work?

                      • Replication

                      • Indexes and Views

                      • Getting Started with CouchDB

                        • Creating a Database

                        • Creating a View

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan