Reply
Anybody know geography data?
Old 05-02-2008, 07:07 PM Anybody know geography data?
Learning Newbie's Avatar
Moderator

Latest Blog Post:
Why do you have a web site?
Posts: 4,161
Name: John Alexander
It's fuuny, a client has a web site with many parts you wouldn't expect. It's on a Linus and Apache web server running PHP code. Lots of AJAX. It's a super heavy hitter as fas as the database side goes, and they're paying us to
  1. Upgrade them from MS SQL Server 2005 to 2008.
  2. Implement geography data and queries.
Part 1 is easy.

Now, I'm writing this because I think people will get a kick out of the idea of PHP running against a Darth Vader software product that's trying to kill its masters. Er, I mean a Microsoft product. But also because the capabilities are fascinating.

They've been using a 3rd server to hit an outside web service to process their geography stuff for them, with massive front line caching. They try to get the user's location from the IP address, show them some other location choices in the web front end, and build a polygon. Then they query locations that are within that polygon. Now all of this can be done through a SQL query.

This is one example.

PHP Code:
 DECLARE @clickedPoint dbo.Geometry
SET @clickedPoint dbo.Geometry::STPoint(@lat, @lon0); 
SELECT c.id
c.shape
c.pop as [Population], 
c.shape.STArea() as [Area], 
(
select count(*) from dbo.business b where c.shape.STIntersects(b.shape)=
 
AND substring(sic,1,2)='58') as [Restaurant Count
FROM dbo.census cdbo.zipcodes z 
WHERE c
.shape.STIntersects(z.shape)=and z.shape.STIntersects(@clickedPoint)=1
I've never worked with or even cared that much about geography - it's always just been there, and the math involved is boring and thorough. It's nice to be able to jump into the pool, tho.
__________________
HungarianNotation is the last resort of scoundrels. Why not the first resort? That's where it counts!
Learning Newbie is online now
Reply With Quote
View Public Profile
 
Sponsored Links (We share ad revenue):
 
Old 05-02-2008, 07:22 PM Re: Anybody know geography data?
tamar's Avatar
Ultra Talker

Posts: 489
Name: Tamar Weinberg
Location: New York
While I don't have an answer for you, I turned on my TV the other night to "Are You Smarter than a 5th Grader" and this Yale graduated Ph.D. lost to a 5th grader on a 3rd grade geography question. It was "what US state borders Kansas and Utah?"

The guy said "Wyoming."

The 5th grader said "Colorado."

The 5th grader won.

I live in NYC, so I'd have no idea
tamar is offline
Reply With Quote
View Public Profile Visit tamar's homepage!
 
Sponsored Links (We share ad revenue):
 
Reply     « Reply to Anybody know geography data?
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML


Page generated in 0.12595 seconds with 15 queries