Build your own MapQuest - PowerPoint PPT Presentation

1 / 36
About This Presentation
Title:

Build your own MapQuest

Description:

Build your own MapQuest! Adding Spatial Smarts to PostgreSQL with PostGIS. Paul Ramsey ... Write Map File ... MapQuest is an example of excellent cartography. ... – PowerPoint PPT presentation

Number of Views:96
Avg rating:3.0/5.0
Slides: 37
Provided by: paulr57
Category:
Tags: mapquest | build | map | quest

less

Transcript and Presenter's Notes

Title: Build your own MapQuest


1
Build your own MapQuest!
  • Adding Spatial Smarts to PostgreSQL with PostGIS

Paul RamseyRefractions Research
2
http//mq-mapgend.websys.aol.com80/mqmapgend?MQMa
pGenRequestFDR2dmwjDE3byt2926FDJnci4Jkqj2cMMCJ
3aHOEvq3bwy5lab3a29uaxlw1w2640243a26402
4s26wzx26a8x26ESEKGF3dTPWIK2crgqabx263d2lla
rwh40243a2640243a26a23a
3
On-the-Fly Cartography
ColorfulPicture
Cartography Engine
GIS Data
4
GIS Data
Dont Panic
  • File Formats
  • Data Organization
  • Coordinate Projections
  • Data Access
  • Data Quality

5
File Formats
  • At least one per vendor
  • ESRI Shape, Coverage, E00, GeoDatabase
  • CAD DXF, DGN
  • Government SDTS, TIGER, DLG
  • MapInfo MIF/MID, TAB
  • Standards GML
  • Open source conversion
  • OGR (gdal.maptools.org/ogr)

6
Data Organization
  • By Administrative Unit
  • Counties, States
  • By Gridding Unit
  • USGS 24K Quads, NTS Mapsheets
  • By Natural Unit
  • Watersheds

7
Coordinate Projections
8
Coordinate Projections
  • United States
  • UTM (Universal Transverse Mercator)
  • Stateplane
  • Lambert
  • Transverse Mercator
  • Geographic
  • Always Find Out the Projection of Your Data
  • .prj file

9
Data Access
  • United States
  • Mostly Free Federal Data
  • www.geodata.gov
  • tiger.census.gov
  • www.fgdc.gov
  • transtats.bts.gov
  • geonames.usgs.gov
  • www.fws.gov/data
  • Some Free State Data
  • Little Free County / Municipal Data

10
Data Acce
  • Commercial Providers
  • NavTeq
  • TeleAtlas ( GDT )
  • MapInfo
  • DigitalGlobe
  • SpaceImaging

11
Data Quality
USGS DLG
TIGER Census
12
Cartography Engine
Proprietary ArcIMS MapExtreme Open Source GeoS
erver
DeeGree UMN Mapserver
13
UMN Mapserver
  • mapserver.gis.umn.edu
  • Multiple Format Support
  • Shape, TAB, Coverage, DGN, PostGIS, More
  • Multiple Projection Support
  • Standards Support
  • OpenGIS Web Map Server
  • OpenGIS Web Feature Server
  • OpenGIS Styled Layer Descriptor

14
UMN Mapserver
Format AProjection 1
Mapserver
Format BProjection 1
Format CProjection 2
Map File ourmap.map
15
MAP EXTENT 1192130 379840 1199560 385520 SIZ
E 400 400 SHAPEPATH "/Users/pramsey/Sites"
PROJECTION "initepsg42102" BC Albers
END LAYER NAME "Lakes" STATUS ON
DATA "lakes" TYPE POLYGON PROJECTION
"initepsg42102" Geographic
END CLASS NAME "Lakes" COLO
R 205 223 255 END END END
16
UMN Mapserver PostGIS
PostGIS / PostgreSQLSpatialDatabase
Mapserver
Map File ourmap.map
17
This is your Database
  • Is there a Main Street?
  • How many patients does the prenatal center
    serve?
  • How many buildings in the city have more than
    two stories?
  • What is the total amount of cash withdrawals for
    customer X?

18
This is your Database on Spatial
  • What is the total length of Main Street?
  • What is the total number of patients within 3
    miles of the prenatal center?
  • How many buildings of more than 2 stories are
    along the parade route?
  • Have all the cash withdrawals for customer X
    been within 50 miles of her primary residence?

19
PostGIS / PostgreSQL
  • Extension to PostgreSQL
  • src/contrib/
  • GEOMETRY
  • Point, Line, Polygon, Multi
  • Functions
  • Indexes
  • http//postgis.refractions.net

20
PostGIS Types
  • POINT
  • LINESTRING
  • POLYGON
  • MULTIPOINT
  • MULTILINESTRING
  • MULTIPOLYGON
  • GEOMETRYCOLLECTION

.
..
21
PostGIS Types
id geometry name
----------------------------------------------
- 1294 POINT(1199437.8 382509.2) Brighton Av
e 1295 POINT(1199369.3 382741.7) York Pl 1
296 POINT(1199494.8 382751) Prospect Pl
22
PostGIS Functions
  • Single Geometry
  • Float Length(Geometry)
  • Float Area(Geometry)
  • Integer NumGeometries(Geometry)
  • Integer NumPoints(Geometry)
  • Geometry Buffer(Geometry,Float)
  • Point PointN(Geometry)
  • Text AsText(Geometry)
  • ByteA AsBinary(Geometry)

23
PostGIS Functions
  • Multiple Geometry
  • Float Distance(Geometry,Geometry)
  • Boolean Touches(Geometry,Geometry)
  • Boolean Intersects(Geometry,Geometry)
  • Boolean Disjoint(Geometry,Geometry)
  • Geometry Intersection(Geometry,Geometry)
  • Geometry GeomUnion(Geometry,Geometry)
  • Geometry Difference(Geometry,Geometry)

24
PostGIS Indexes
  • Geometries Require Special Index
  • Sortable in two dimensions
  • Cover range of values
  • R-Tree Index (GiST Implementation)
  • Linear Time Picksplit Algorithm
  • http//postgis.refractions.net/rtree.pdf

25
(No Transcript)
26
(No Transcript)
27
Get on with it!!
Get on with it!!
28
Our Architecture
PostGIS / PostgreSQLSpatialDatabase
Mapserver
Map File ourmap.map
GIS Data
29
Our Steps
  • Install / Setup
  • Mapserver, PostGIS
  • GDAL, OGR, PROJ4, GD
  • Acquire GIS Data
  • Load GIS Data ? PostGIS
  • Write Map File for Mapserver
  • Profit!

30
Acquire Data
  • For demo, hunted down Oregon data
  • 1981636 Jul 28 1202 OR_deci.zip
  • 564501 Jul 28 1155 county.zip
  • 34729355 Jan 9 2003 hydrogm020.tar.gz
  • 62246216 Jul 28 1155 gdt.zip
  • 1853534 Jul 28 1155 railroads.zip
  • 3293501 Jul 28 1242 s_12my03.zip

31
Load Data
  • Load names data with perl script
  • "OR","4H Camp","locale","Coos",41,011,"431355N",
    "1235945W",43.23194,-123.99583,"","",,,216,,"","Do
    ra"
  • INSERT INTO names VALUES (1,'OR','4H
    Camp','locale','Coos', 'SRID4269POINT(-123.9958
    3 43.23194)', 216,NULL,'Dora)

32
Load Shape Files
  • PostGIS includes Shape loader utility
  • shp2pgsql -s 200000 \counties.shp counties
    psql demo-oregon

33
Write Map File
  • Good computer cartography is the artful
    combination of elements, styles, colors and data
    at appropriate scales.
  • MapQuest is an example of excellent cartography.

  • So is a National Geographic Atlas of the World.

34
LAYER TEMPLATE template.html DUMP TRUE
NAME "States" METADATA
"wms_title" "States" END STATUS ON
DATA "the_geom from states" TYPE POLYGON
CONNECTIONTYPE POSTGIS CONNECTION "userpram
sey dbnamedemo-oregon" PROJECTION "in
itepsg4269" END CLASSITEM "admin_name"
CLASS NAME "States" COLOR 255
255 230 OUTLINECOLOR 20 20 20 EXPRES
SION "Oregon" END CLASS NAME "Sta
tes" COLOR 240 240 240 OUTLINECOLOR
20 20 20 END END
35
(No Transcript)
36
Demonstration
  • iBook G3 800Mhz 128MB
  • PostGIS / PostgreSQL, Mapserver, Apache
  • Roads
  • States
  • Counties
  • Geographical Names
  • Water Features
Write a Comment
User Comments (0)
About PowerShow.com