Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



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

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
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.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Learning Newbie is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-02-2008, 08:22 PM Re: Anybody know geography data?
tamar's Avatar
Webmaster Talker

Posts: 507
Name: Tamar Weinberg
Location: New York
Trades: 0
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
__________________

Please login or register to view this content. Registration is FREE
tamar is offline
Reply With Quote
View Public Profile Visit tamar's homepage!
 
Reply     « Reply to Anybody know geography data?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB 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.10216 seconds with 12 queries