<html>
<head>
<title></title>
<meta content="MSHTML 6.00.6000.16809" name="GENERATOR"></meta>
</head>
<body>
<div>Hi Simon</div>
<div> </div>
<div>I'm afraid I don't really get your question.</div>
<div> </div>
<div>But, what I ment was that he should have a colun with the individual radius for each row. He described that the radius could be different for each "circle", so I guess he have to supplie the radius for each row.</div>
<div>Then the st_dwithin-function will check if the random point is within the radius (taken from the radius-column) from the random-point.</div>
<div> </div>
<div>/Nicklas<br />
<br />
2009-04-14 Simon Greener wrote:<br />
<br />
Niklas,<br />
><br />
>What values for theradius do you give st_dwithin given that you don't know the values of the radius value in the table? What if you supply a radius of 1,000KM and there happens to be a point outside this whose radius is 1,500KM?<br />
><br />
>regards<br />
>SImon<br />
>><br />
>> Hi<br />
>> <br />
>> No you don't have to make a circle first. One way is to just do a radius search from your point with the given radius.<br />
>> If you have one column with latitude and one with longitude and one with radius then this should work<br />
>> <br />
>> select * from thetable where st_dwithin(randompoint,ST_MakePoint(theLongitud, theLatitud), theradius);<br />
>><br />
>> The query might get slow if you have a big table as you descibed.<br />
>> Then it might be a good idea to create a geometry column and store the latlongs as points.<br />
>> <br />
>> SELECT AddGeometryColumn( 'public', 'thetable', 'thepoint_lonlat', 4269, 'POINT', 2 );<br />
>> The above code will create a geometry column named thepoint_longlat in the table zctas that validates to make sure the inputs are 2-dimensional points in SRID 4269 (NAD83 longlat).<br />
>> the above is copied from www.bostongis.org<br />
>> <br />
>> and then fill thegeometry with data like:<br />
>> update thetable setthepoint_lonlat= st_makepoint(ST_MakePoint(theLongitud, theLatitud))<br />
>> <br />
>> then you can make a gist-index on the column.<br />
>> <br />
>> and I think in your case it could work with making a gist index like<br />
>> <br />
>> create index idx_lat_long_radius<br />
>> on thetable<br />
>> using gist(st_buffer(thepoint_lonlat, theradius))<br />
>> <br />
>> then you should get boundingboxes stored for each point/radius-circle<br />
>> <br />
>> Then you can run the above query:<br />
>> select * from thetable where st_dwithin(randompoint,thepoint_lonlat, theradius);<br />
>> <br />
>> I'm not good in indexes, but I think this will be a fast solution.<br />
>> <br />
>> /Nicklas<br />
>> <br />
>><br />
>> 2009-04-14 Tony Elmore wrote:<br />
>><br />
>> Admittedly, I have not spent a tremendous amount of time with this yet<br />
>>>- so I'm not really asking for a solution here, but would like some<br />
>>>feedback to determine if I'm on the right track.<br />
>>><br />
>>>Is this scenario possible using postGIS?<br />
>>><br />
>>>i have many items (hundreds of thousands) with each item containing a<br />
>>>lat / lng and a radius (each item could have a different radius). The<br />
>>>circle created by the lat / lng and radius for each item would in all<br />
>>>likelihood overlap with other items.<br />
>>><br />
>>>Given a random point, is it possible to retrieve all of the rows where<br />
>>>the random point is inside the circle created from the lat / lng and<br />
>>>radius?<br />
>>><br />
>>>I would assume I should create the circle for each item first and<br />
>>>store that as geometry.<br />
>>><br />
>>>Could someone please verify that this scenario is appropriate for<br />
>>>postgis.<br />
>>><br />
>>>Regards,<br />
>>>Tony<br />
>>>_______________________________________________<br />
>>>postgis-users mailing list<br />
>>>postgis-users@postgis.refractions.net<br />
>>>http://postgis.refractions.net/mailman/listinfo/postgis-users<br />
>>><br />
>>><br />
><br />
><br />
><br />
>-- <br />
>SpatialDB Advice and Design, Solutions Architecture and Programming,<br />
>Oracle Database 10g Administrator Certified Associate; Oracle Database 10g SQL Certified Professional<br />
>Oracle Spatial, SQL Server, PostGIS, MySQL, ArcSDE, Manifold GIS, FME, Radius Topology and Studio Specialist.<br />
>39 Cliff View Drive, Allens Rivulet, 7150, Tasmania, Australia.<br />
>Website: www.spatialdbadvisor.com<br />
> Email: simon@spatialdbadvisor.com<br />
> Voice: +613 9016 3910<br />
>Mobile: +61 418 396391<br />
>Skype: sggreener<br />
>Longitude: 147.20515 (147° 12' 18" E)<br />
>Latitude: -43.01530 (43° 00' 55" S)<br />
>NAC:W80CK 7SWP3<br />
>_______________________________________________<br />
>postgis-users mailing list<br />
>postgis-users@postgis.refractions.net<br />
>http://postgis.refractions.net/mailman/listinfo/postgis-users<br />
><br />
></div>
</body>
</html>