Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal...

66
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED. Deep Dive: Take a Tour With Geospatial Jake Fowler (Senior Software Engineer) & Jennifer Tsau (Product Manager)

Transcript of Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal...

Page 1: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

Deep Dive: Take a Tour With Geospatial Jake Fowler (Senior Software Engineer) & Jennifer Tsau (Product Manager)

Page 2: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 2

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

Disclaimer

MarkLogic 9 is currently under development. The features and how they are implemented are subject to change.

Page 3: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 3

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

Before we get started, let’s do a quick poll… … How many of you are using MarkLogic’s geospatial features today?

… How many of you are not using MarkLogic’s geospatial features today,

but are familiar with the broader community of geospatial technology (GIS)?

…How many of you attended the

Designing with MarkLogic –

Geospatial Workshop?

Page 4: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 4

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

Page 5: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

80% of all data has a geospatial component

Page 6: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 6

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

• A Paradigm Shift & Unique Solution: MarkLogic Geospatial

• Technical Deep-Dive: A Journey Into the Internals of MarkLogic Geospatial

Today’s Itinerary DEEP DIVE: TAKE A TOUR WITH GEOSPATIAL

PARADIGM SHIFT

AHEAD

Page 7: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 7

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

FT_FeatureID FT_Geometry FT_FeatureType FT_FeatureUse

1 Polygon Non-residential School

2 Polygon Non-residential Training Center

3 Polygon Non-residential Church

4 Polygon Residential Apartment Complex

Geospatial concepts have been boxed by a relational mindset

TODAY’S WORLD

Page 8: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 8

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

FT_FeatureID FT_Geometry FT_FeatureType FT_FeatureUse

1 Polygon Non-residential School

2 Polygon Non-residential Training Center

3 Polygon Non-residential Church

4 Polygon Residential Apartment Complex

Geospatial concepts have been boxed by a relational mindset

TODAY’S WORLD

OGC OpenGIS Abstract Specification Topic 5: Features Geometry Schema: “demand that rules for representing each feature type with WKTs is explicit” Attribute Schema “demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

Page 9: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 9

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

Think of, interact with “location” in a different way

WELCOME TO MARKLOGIC WORLD

Page 10: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 10

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

Variance in geospatial representation (e.g. point, polygon)

Variance in attributes

Paradigm Shift #1 – Create features that mirror reality

1651 Union Street, San Francisco, CA

Page 11: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

<doc>

<feature>

<address>1651 Union Street, San Francisco, CA<address>

<coordinates>POINT(-122.4283871 37.7980631)</coordinates>

<type>Non-residential</type>

<address-usage>

<use>school</use>

<geometry>MULTIPOLYGON((…))</geometry>

<name>Sherman Elementary</feature-name>

<population>1200</population>

</address-usage>

<address-usage>

<use>training center</use>

<geometry>MULTIPOLYGON((…))</geometry>

<contact-email>[email protected]</contact-email>

<contact-phone>1-415-123-4567</contact-phone>

</address-usage>

<address-usage>

<use>church</use>

<geometry>POLYGON((…))</geometry>

<notes>Meets in school auditorium</notes>

<contact-phone>1-415-634-5474</contact-phone>

</address-usage>

</feature>

...

</doc>

FT_FeatureID FT_Geometry FT_Type FT_Use FT_Address_ID

1 Multipolygon((…)) Non-residential

School 1

2 Multipolygon((...)) Non-residential

Training Center 1

3 Polygon((…)) Non-residential

Church 1

FT_Address_ID FT_Address FT_Coordinates

1 1651 Union Street, San Francico, CA

Point(-122.42838 37.79806)

… … …

• What do I do when there is variance in my attributes?

• What if I introduce another feature that doesn’t “fit” the same schema?

4 Point(-122.42840 37.79817

Residential Apartment Complex

2

2

1600 Clay Street, San Francisco, CA

Point(-122.42840 37.79817)

Page 12: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

<doc>

<feature>

<address>1651 Union Street, San Francisco, CA<address>

<coordinates>POINT(-122.4283871 37.7980631)</coordinates>

<type>Non-residential</type>

<use>school</use>

<geometry>MULTIPOLYGON((…))</geometry>

<name>Sherman Elementary</feature-name>

<population>1200</population>

<use>training center</use>

<geometry>MULTIPOLYGON((…))</geometry>

<contact-email>[email protected]</contact-email>

<contact-phone>1-415-123-4567</contact-phone>

<use>church</use>

<geometry>POLYGON((…))</geometry>

<contact-phone>1-415-634-5474</contact-phone>

</feature>

</doc>

FT_FeatureID FT_Geometry FT_Type FT_Use FT_Address_ID

1 Multipolygon((…)) Non-residential

School 1

2 Multipolygon((...)) Non-residential

Training Center 1

3 Polygon((…)) Non-residential

Church 1

FT_Address_ID FT_Address FT_Coordinate

1 1651 Union Street, San Francico, CA

Point(-122.42838 37.79806)

… … …

• What do I do when there is variance in my attributes?

• What if I introduce another feature that doesn’t “fit” the same schema?

4 Point(-122.42840 37.79817

Residential Apartment Complex

2

2

1600 Clay Street, San Francisco, CA

Point(-122.42840 37.79817)

Greater flexibility in defining a “feature”

Greater flexibility in building your location-aware applications

Page 13: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 13

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

Paradigm Shift #2 – Integrate geospatial across the org

FT_ID FT_Location FT_FacilityType FT_FeatureName

1 Polygon((..)) Hospital Oakland Clinic

2 Polygon((..)) Hospital UCSF

3 Polygon((..)) Medical Foundation

Palo Alto Medical Foundation

FT_ID FT_Address PatientID

9012 Point(…) 7432

9013 Point(…) 7433

9014 Point(…) 7434

9015 Point(…) 7435

PatientID PatientName PatientAddress PatientDOB SSN

7432 Betty Crocker 123 Cherry Lane 1973-10-04 589-78-4562

7433 Sam Kumar 523 Happy Ave 1982-04-12 789-75-9865

7434 John Chen 999 Holly Street 1965-07-23 612-89-1268

7435 Sally Smith 681 Branch Lane 1942-11-13 432-32-5932

PAT_RecID PAT_First PAT_Last PAT_Home

432-32-5932 Sally Smith 314 Franklin Dr

311-54-2391 Albus Dumbledore 97 Hogwarts Ln

431-59-4321 Hermoine Granger ….

695-27-1093 Ron Weasley ….

EncounterID PatientID ProviderID

65871 7435 5-87965

65872 … …

MED_ID LAST FIRST ADDRESS

9435-12 Jennifer Lawrence 233 Holly Street

… … … …

MeetingRec MED_ID PHYSICIAN_ID

3439204 9435-12 1234-56

65872 … …

ApptID PAT_RecID PROV_ID

YAS-41 432-32-5932 9-32156

DPD-43 311-54-2391 8-42132

SLR-52 … …

Page 14: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 14

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

Paradigm Shift #2 – Integrate geospatial across the org

Page 15: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

<patient-doc> <UCSF-patient-record> <PatientID>7435</PatientId> <PatientName>Sally Smith</PatientName> <PatientAddress>681 Branch Lane</PatientAddress> <PatientDOB>1942-11-13</PatientDOB> <coordinates>POINT(-122.4283871 37.7980631)</coordinates>

... </UCSF-patient-record> <UCSF-appointment-record> <apptID EncounterID=“7435”> <ProviderID>5-87965</ProviderID> <location>POLYGON((..))</location> </apptID>

... </UCSF-appointment-record> <oakland-clinic-patient-record> <PAT_RecID>432-32-5932</PAT_RecID> <PAT_First>Sally</PAT_First> <PAT_Last>Smith</PAT_Last> <PAT_Home>314 Franklin Dr</PAT_Home> <coordinates>POINT(..)</coordinates>

... </oakland-clinic-patient-record> <oakland-clinic-appointment-record> <apptID ApptID=“YAS-41”> <PROV_ID>9-32156</PROV_ID> <location>POLYGON((..))</location> </apptID>

... </oakland-clinic-appointment-record> </patient-doc>

PatientID

PatientName PatientAddress PatientDOB

7432 Betty Crocker 123 Cherry Lane 1973-10-04

7433 Sam Kumar 523 Happy Ave 1982-04-12

7434 John Chen 999 Holly Street 1965-07-23

7435 Sally Smith 681 Branch Lane 1942-11-13

PAT_RecID PAT_First PAT_Last PAT_Home

432-32-5932 Sally Smith 314 Franklin Dr

311-54-2391 Albus Dumbledore 97 Hogwarts Ln

431-59-4321 Hermoine Granger ….

EncounterID PatientID ProviderID

65871 7435 5-87965

65872 … …

ApptID PAT_RecID PROV_ID

YAS-41 432-32-5932 9-32156

DPD-43 311-54-2391 8-42132

SLR-52 … …

FT_ID FT_Location FT_FacilityType FT_FeatureName

1 Polygon((..)) Hospital Oakland Clinic

2 Polygon((..)) Hospital UCSF

3 Polygon((..)) Medical Foundation

Palo Alto Medical Foundation

Page 16: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

<patient-doc> <UCSF-patient-record> <PatientID>7435</PatientId> <PatientName>Sally Smith</PatientName> <PatientAddress>681 Branch Lane</PatientAddress> <PatientDOB>1942-11-13</PatientDOB> <coordinates>POINT(-122.4283871 37.7980631)</coordinates>

... </UCSF-patient-record> <UCSF-appointment-record> <apptID EncounterID=“7435”> <ProviderID>5-87965</ProviderID> <location>POLYGON((..))</location> </apptID>

... </UCSF-appointment-record> <oakland-clinic-patient-record> <PAT_RecID>432-32-5932</PAT_RecID> <PAT_First>Sally</PAT_First> <PAT_Last>Smith</PAT_Last> <PAT_Home>314 Franklin Dr</PAT_Home> <coordinates>POINT(..)</coordinates>

... </oakland-clinic-patient-record> <oakland-clinic-appointment-record> <apptID ApptID=“YAS-41”> <PROV_ID>9-32156</PROV_ID> <location>POLYGON((..))</location> </apptID>

... </oakland-clinic-appointment-record> </patient-doc>

PatientID

PatientName PatientAddress PatientDOB

7432 Betty Crocker 123 Cherry Lane 1973-10-04

7433 Sam Kumar 523 Happy Ave 1982-04-12

7434 John Chen 999 Holly Street 1965-07-23

7435 Sally Smith 681 Branch Lane 1942-11-13

PAT_RecID PAT_First PAT_Last PAT_Home

432-32-5932 Sally Smith 314 Franklin Dr

311-54-2391 Albus Dumbledore 97 Hogwarts Ln

431-59-4321 Hermoine Granger ….

EncounterID PatientID ProviderID

65871 7435 5-87965

65872 … …

ApptID PAT_RecID PROV_ID

YAS-41 432-32-5932 9-32156

DPD-43 311-54-2391 8-42132

SLR-52 … …

FT_ID FT_Location FT_FacilityType FT_FeatureName

1 Polygon((..)) Hospital Oakland Clinic

2 Polygon((..)) Hospital UCSF

3 Polygon((..)) Medical Foundation

Palo Alto Medical Foundation

Location data lives with the rest of your data

No need to manage it in a separate, special way

Page 17: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 17

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

Paradigm Shift #3 – Interact with location using rich, complex queries

Page 18: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

<patient-doc>

<patient-record>

<PatientID>7435</PatientId>

<PatientName>Henry Evans</PatientName>

<PatientAddress>681 W Court street</PatientAddress>

<PatientDOB>2012-05-13</PatientDOB>

<coordinates>POINT(-83.766455 43.0125902)</coordinates>

...

</patient-record>

<appointment-record>

<apptID EncounterID=“7435”>

<ProviderID>5-87965</ProviderID>

<location>POLYGON((..))</location>

<time>2016-05-03T14:30:00</time>

<Diagnosis>Food Poisoning</Diagnosis>

<Notes>

Abdominal pain, vomiting, nausea. Vomiting for

1 week, abdominal pain symptoms 2 weeks and

persisting

</Notes>

</apptID>

...

</appointment-record>

</patient-doc>

Combine full-text search with geospatial

Build alerting functionality based on location

“Find me all records for patients who live in the 5-mile radius of Flint, Michigan that mention the phrase “abdominal pain” and “nausea” in the same appointment.

“Whenever a patient under 10, who lives within a 5-mile radius of Flint, Michigan checks in, trigger an alert for the nurse to conduct a lead poisoning test.”

Page 19: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

<patient-doc>

<patient-record>

<PatientID>7435</PatientId>

<PatientName>Henry Evans</PatientName>

<PatientAddress>681 W Court street</PatientAddress>

<PatientDOB>2012-05-13</PatientDOB>

<coordinates>POINT(-83.766455 43.0125902)</coordinates>

...

</patient-record>

<appointment-record>

<apptID EncounterID=“7435”>

<ProviderID>5-87965</ProviderID>

<location>POLYGON((..))</location>

<time>2016-05-03T14:30:00</time>

<Diagnosis>Food Poisoning</Diagnosis>

<Notes>

Abdominal pain, vomiting, nausea. Vomiting for

1 week, abdominal pain symptoms 2 weeks and

persisting

</Notes>

</apptID>

...

</appointment-record>

</patient-doc>

Combine full-text search with geospatial

Build alerting functionality based on location

“Find me all records for patients who live in the 5-mile radius of Flint, Michigan that mention the phrase “abdominal pain” and “nausea” in the same appointment.

“Whenever a patient under 10, who lives within a 5-mile radius of Flint, Michigan checks in, trigger an alert for the nurse to conduct a lead poisoning test.”

Write rich, complex queries that involve location

Ask the “where” questions you couldn’t ask before

Page 20: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 20

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

Customers use MarkLogic Geospatial to…

Page 21: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 21

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

Fairfax County Unified land use search platform across

5.4 million records

Improved service to county employees and citizens

Real-time data loaded in hours, not weeks

Reduced maintenance and support costs

CUSTOMER USE CASE

Page 22: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 22

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

DHL Parcel Benelux Track and trace system for 150,000

packages/day

First-class, speedy service to retail clients

Flexibility to support new e-commerce companies

Faster data integration, faster ROI

CUSTOMER USE CASE

Page 23: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 23

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

Enterprise NoSQL Database Platform

Geospatial Support

Native JSON Store

Native XML Store

Native RDF Triple Store

POWERFUL

Flexible Indexes

Full-text Search

Real-time Alerting Bitemporal

Tiered Storage

Semantic Inference

Fully Transactional

Server-side JavaScript

REST API

Scalable and Elastic

Cloud Ready (AWS)

Hadoop and HDFS

AGILE

Multi-OS Support

SQL Support

Samplestack Schema Agnostic

XA Transactions

MarkLogic Content Pump

Index Across Data Types

Ad-hoc Queries

Monitoring and Management

Performance at scale

LDAP & Kerberos Security

Security Certifications

TRUSTED

24/7 Engineering Support

Configuration Management

Flexible Replication

ACID Transactions

Customizable Failover

Customizable Backup

Atomic Forests

Point-in-time Recovery

Page 24: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 24

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

MarkLogic Geospatial Features

Geospatial Point Search

WGS84 & Raw Coordinate System

indexes

Float precision indexes

A wide variety of geospatial APIs

KML GML GeoRSS Metacarta

WKB

WKT

GeoJSON

Geospatial Region Search

Double precision indexes

Page 25: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

MARKLOGIC GEOSPATIAL Technical Deep Dive

Page 26: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

Geospatial Data An example…

Page 27: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

{"type":"Feature","properties":{"facility_i":"0000003185","dept":"7","school_typ":"Elementary","deptname":"SF Unified School District (SFUSD)","facility_n":"Ulloa Elementary School"},"geometry":{"type":"Point","coordinates":[-122.49938854722042,37.73733034833979]}}

<Placemark><ExtendedData><Data name="deptname"><value>SF Unified School District (SFUSD)</value></Data><Data name="facility_n"><value>Ulloa Elementary School</value></Data><Data name="facility_i"><value>0000003185</value></Data><Data name="dept"><value>7</value></Data><Data name="school_typ"><value>Elementary</value></Data></ExtendedData><Point><coordinates>-122.49938854722042,37.73733034833979</coordinates></Point></Placemark>

Page 28: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

{"type":"Feature","properties":{"facility_i":"0000003185","dept":"7","school_typ":"Elementary","deptname":"SF Unified School District (SFUSD)","facility_n":"Ulloa Elementary School"},"geometry":{"type":"Point","coordinates":[-122.49938854722042,37.73733034833979]}}

<Placemark><ExtendedData><Data name="deptname"><value>SF Unified School District (SFUSD)</value></Data><Data name="facility_n"><value>Ulloa Elementary School</value></Data><Data name="facility_i"><value>0000003185</value></Data><Data name="dept"><value>7</value></Data><Data name="school_typ"><value>Elementary</value></Data></ExtendedData><Point><coordinates>-122.49938854722042,37.73733034833979</coordinates></Point></Placemark>

Page 29: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 29

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

Latitude and Longitude Geospatial data is stored by latitude and longitude.

These two numbers identify a point on the earth. Longitude

Latit

ude

Page 30: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

{

"type": "Feature",

"properties": {

"facility_i": "0000003185",

"dept": "7",

"school_typ": "Elementary",

"deptname": "SF Unified School District (SFUSD)",

"facility_n": "Ulloa Elementary School"

},

"geometry": {

"type": "Point",

"coordinates": [-122.49938854722042,37.73733034833979]

}

}

Page 31: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 31

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

Geospatial Data in MarkLogic MarkLogic automatically understands the structure of the data.

MarkLogic does not know the meaning (semantics) of the data.

MarkLogic is schema-agnostic.

You must tell MarkLogic which part of the data is the location.

Why does MarkLogic need to know this?

To search for documents that contain locations in specific places!

Page 32: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

Geospatial Search

Page 33: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 33

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

Answers location-based questions

Examples:

Have all the park benches between 5th and 7th street been painted?

Which of my customers live in or around San Francisco?

Geospatial Search

Page 34: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 34

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

Understanding Geospatial Search Geospatial Indexes enable fast location-based search

Search and indexing are two sides of the same coin

Page 35: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 35

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

What Is an index? An interesting subset of the data

References back to the source of the data

Organized to find specific items of interest

Page 36: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 36

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

MarkLogic Range Indexes MarkLogic’s range indexes also satisfy these three conditions.

Stores a specific subset of the data.

(Specified by XML element name, JSON property name, etc.)

Refers back to the original document URI.

Data is of a type that can be sorted.

Examples: numbers, dates, strings

Page 37: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

URI: joe.xml

<user>

<name><first>Joe</first><last>Shmo</last></name>

<age>34</age>

<status>single</status>

</user>

Page 38: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

<age> Document Document <age>

... ...

18 kim.xml bob.xml 19

19 bob.xml carol.xml 40

22 jeff.xml, jessie.xml jeff.xml 22

25 susan.xml jessie.xml 22

30 mary.xml, steve.xml joe.xml 34

34 joe.xml kim.xml 18

40 carol.xml mary.xml 30

52 rick.xml sam.xml 55

55 sam.xml steve.xml 30

... ...

Page 39: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 39

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

Geospatial Indexes Geospatial indexes are a type of range index

Points can be sorted

Sort first by latitude, then by longitude

A “two dimensional” range index

Page 40: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 40

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

Geospatial Indexes

Page 41: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 41

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

Geospatial Indexes

Page 42: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 42

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

Page 43: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 43

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

Geospatial Search Index resolution is easy for rectangles

Other regions require more steps

Let’s look at an example…

Page 44: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 44

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

Page 45: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

//An example geospatial search...

var usa = cts.polygon(“POLYGON((...))”);

var qry = cts.elementGeospatialQuery(

xs.QName(“coordinates”),

usa);

cts.search(qry);

Page 46: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 46

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

Index Resolution Step 1: Restrict results based on bounding boxes

Page 47: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 47

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

Page 48: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 48

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

Index Resolution Step 1: Restrict results based on bounding boxes

Quickly rules out many points that don’t match

Use finer bounding boxes

Page 49: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 49

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

Page 50: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 50

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

Index Resolution Step 1: Restrict results based on bounding boxes

Quickly rules out many points that don’t match

Use finer bounding boxes Fewer non-matches; minimal performance impact

See them with geo:bounding-boxes with option box-percent=100

Step 2: Check each point against the search region

Page 51: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 51

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

Page 52: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 52

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

Index Resolution Step 1: Restrict results based on bounding boxes

Quickly rules out many points that don’t match

Use finer bounding boxes Fewer non-matches; minimal performance impact

See them with geo:bounding-boxes with option box-percent=100

Step 2: Check each point against the search region

Result: Search returns accurate results

No filter step is necessary

Page 53: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

Geometry on the Earth

Page 54: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 54

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

Geometry on the Earth

Vs.

Page 55: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 55

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

Map Projections

Page 56: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 56

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

Carl Friedrich Gauss (1777–1855)

Theorema Egregium (1827)

Any flat map will have distortion.

This is because the Earth has intrinsic curvature.

A.k.a. Gaussian curvature.

Geometry on the Earth

Page 57: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 57

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

“Non-Euclidean” geometry.

Shortest distance on Earth is not a straight line.

Shortest distance follows a Great Circle.

Also called a Geodesic.

Geometry on the Earth

Page 58: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 58

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

Great Circle Arcs

Image source: http://flylib.com/books/en/2.366.1.61/1/

Page 59: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 59

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

Geometry on the Earth

Vs.

Page 60: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 60

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

Geometry on the Earth Actually, Earth is not a sphere

It bulges around the equator

Due to the centrifugal force of its rotation

Earth is an ellipsoid

Page 61: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 61

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

Geodesic Polygons In MarkLogic, the edges of polygons are geodesics

Point-in-polygon – ray-casting algorithm

Is point P inside the polygon?

Draw a geodesic from P to exterior point (e.g. north pole)

Count number of intersections with polygon edges Odd => inside

Even => not inside

Worst case: must calculate intersections for every edge of polygon Computationally expensive for polygons with lots of vertices

Page 62: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 62

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

MarkLogic Geospatial Combine Geospatial Search with full-

text search and range queries to make rich applications.

Unlock your location data!

Page 63: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

WRAP-UP

Page 64: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 64

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

What’s next? Wednesday, May 11

(11:00AM – 11:50AM) ESRI & MarkLogic: Do More With Your GIS (3:15PM – 4:05PM) EBCONT: Implementing a Big Data Strategy for the

Passenger Rail Agency of South Africa

Page 65: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 65

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

More Information & Resources MarkLogic Documentation

http://docs.marklogic.com/guide/search-dev/geospatial

MarkLogic University

Geospatial Basics (On Demand Course)

Using Node.js: The Geophoto App (On Demand Course)

Developer Community

http://developer.marklogic.com/

GitHub Repositories

Google Maps for MarkLogic

ESRI Maps for MarkLogic

Page 66: Deep Dive: Take a Tour With Geospatial...“demands that each attribute in the list have a formal attribute name, and that each attribute take a value of a type specific for that attribute”

SLIDE: 66

© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.

Q&A