![]() |
yeah MySQL, you are my BITCH
well, she was winning for a while, but she can be tamed...
SELECT *, AsText(geometry) FROM geo_data WHERE Intersects( GeomFromText('POLYGON((43.3723651907 5.4,43.2999559362 5.49943509666,43.2276328093 5.40000000532,43.2999559284 5.30056490336,43.3723651907 5.4))'),geometry ) ORDER BY SQRT(POW( ABS( X(geometry) - X( GeomFromText('POINT(43.3723651907 5.4)') )), 2) + POW( ABS(Y(geometry) - Y( GeomFromText('POINT(43.3723651907 5.4)') )), 2 )) OK, sorry you had to read this, but sometimes when you fight for so long, winning is sooooo sweeeet. :pimp . As you were |
I see your geo sig working :)
|
thats one big sql statement
|
Sweet! Fight the Machine!
|
I tried that statement on my server and it melted
|
Yeah, baibiiiiiiiiiii!
|
Your sig is looking good. By far the closest GeoIP locations then I've seen. Very good work.
|
Quote:
6668045 rows in total the sql query: Showing rows 0 - 13 (14 total, Query took 0.0042 sec) mysql spatial indices kick frikken ass! Sad think is, I'm just amusing myself, trying to tweak 'nearby' searches to be faster and more accurate. This did it but some more coding before it goes live. Sad geeks :thumbsup |
and those paying attention would point out to me my error:
SQRT(POW( ABS( X(geometry) - X( GeomFromText('POINT(43.3723651907 5.4)') )), 2) + POW( ABS(Y(geometry) - Y( GeomFromText('POINT(43.3723651907 5.4)') )), 2 )) those POINT() values should be the center of the polygon, not the top left corner, as shown there :winkwink: |
http://www.geoplugin.net/extras/near...xml&radius=100
All the nearest populated places to you within a 100 mile radius XML output :pimp Mission accomplished . |
Nice job man! keep it up and I may replace using my own geo database from maxmind with your solution in my products :D
|
The real question is, how long does it take to run.
|
borked are you freelancing these days?
|
I was more impressed with your sig when it gave me my location in Cyrillic (which is what we use), now it's all Latin
|
Quote:
That way I can search the database for your example and find out what changed during he modificaitons. Cheers |
Quote:
geo_data 6,668,045 INNODB latin1_swedish_ci 1.5 GiB On a query with a polygon covering 100 miles around my location query: SELECT name, country, region, latitude, longitude FROM geo_data WHERE place_type = 'P' AND place_code = 'PPL' AND alternate_names != '' AND INTERSECTS( GEOMFROMTEXT( 'POLYGON((44.7473228148 5.4,43.2827760916 7.38832741803,41.8526751852 5.40000010412,43.2827759366 3.41167258704,44.7473228148 5.4))' ) , GEOMETRY ) ORDER BY SQRT( POW( ABS( X( GEOMETRY ) - X( GEOMFROMTEXT( 'POINT(43.299999 5.400000)' ) ) ) , 2 ) + POW( ABS( Y( GEOMETRY ) - Y( GEOMFROMTEXT( 'POINT(43.299999 5.400000)' ) ) ) , 2 ) ) LIMIT 0 , 30 Run time: Showing rows 0 - 29 (2,468 total, Query took 0.0826 sec) ooooh yeah :pimp |
Quote:
here's one http://www.6dicksunder.com/hl/c.jpg |
Quote:
Now that the code lookup/replace works on the nearby stuff, I'll be swapping them out in the geoip lookups next. And fixing this cyrillic/latin swap that happened. That's the problem with these databases - if you aren't in that locality, it's a bitch to try and squash bugs cos you never see them! |
I'm sure it'll run great when you toss it on a site doing 300k/day...
|
Quote:
eg: Sarafovo Sarafovo Antim I,Paparos,Papure,Sarafovo,Sarefovo,Сарафово Saraevo Saraevo 3333,Saraevo,Saraewo,Сараево Sanur Dere Sanur Dere Sanur Dere,Санър Дере the names got moved over to alternate names column. Damn damn - not easy to reverse, but I'll try |
Quote:
top - 23:29:53 up 12 days, 10:55, 1 user, load average: 0.24, 0.30, 0.27 have a look at the bottom of the html source on any of evilangel's sites if you don't believe it is getting hammered. load-balanced server with a powerful beast running mysql |
Quote:
only one million?:1orglaugh:1orglaugh:1orglaugh jk - your hamster style is impressive :thumbsup http://www.nanarland.com/Chroniques/.../orgazmo03.jpg |
I fucked her in her arse.
|
Quote:
|
Quote:
|
borked is a hacker
|
i love mysql
|
Quote:
|
job well done
|
Used as a term of endearment.
|
Your sig is damn impressive! Some of the smallest no people having places around on there
|
Looks like Query analyzer error.
|
Quote:
Follow the link in the sig - the script is available for free. GPL license. |
Quote:
I'm interested in knowing how the nearby stuff works for you, from brazil... Thanks for the feedback |
All times are GMT -7. The time now is 07:42 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123