Yes, my underlying data is being served up by ArcGIS Server, which lets me
search by intersection with a bounding box, then I was planning on
filtering.  If I try porting the distance algorithm (probably not until next
week) I'll let you know how it goes.

The other suggestion I got from a coworker was to reproject the center point
of the circle into a Cartesian system, use it there to create an approximate
circle (100 points around the edge, or maybe even 50 or 25 would probably be
plenty circular enough for this type of search), reproject that circle back
to the original coordinate system, and do an intersection search using that
instead of using a bounding box.  I think I'd have to figure out the correct
projection to use so my circle didn't get messed up going back to web
mercator, but that may be the most performant option since I'm reprojecting
a relatively small number of points.

That does only solve case 1 however, for case 2 I still need to calculate
the shortest distance among various polygons.

Jeff

On Thu, Feb 5, 2009 at 2:40 PM, Martin Davis <[email protected]>wrote:

> Check this out:
>
> http://www.movable-type.co.uk/scripts/latlong-vincenty.html
>
> Should be easy to port the code.
>
> If you do this, can you report out on your experience?  E.g. does this run
> fast, does it give you the results you're looking for, etc.
>
> Jeff Adams wrote:
>
>> Wow, what a conversation I started!
>>
>> So here's my use case:
>>
>> I have a web app that is displaying polygons and points (different layers)
>> on a "North America" scale (although of course you can zoom in to any
>> particular area of interest).  All the data is in "Web Mercator" projection.
>>
>> 1) I need to allow the user to choose a location and "search by radius (in
>> miles)" for features in one of the point or polygon layers.
>> 2) I need to find the nearest polygon to a point (although this one is
>> less critical, as it's a hack to get around bad data and there's a chance we
>> can get better data).
>>
>> Any reprojecting I will be doing will be on the fly, as the underlying
>> data has to remain in web mercator.  Since we're talking a web app, I'm a
>> little concerned about reprojecting a whole lot of polygons on the fly just
>> to check distance, I'm concerned that performance will be a problem (I.E. it
>> won't be very responsive).  Some of the polygons follow county boundaries
>> and stuff so they can have a lot of points (although I could simplify them
>> first if it were faster).
>>
>> Paul, I would love to get your code for "Vicinity Distance".  In the
>> interests of full disclosure however I must admit this is paid work for a
>> commercial customer, so I can understand if you do not wish to give me a
>> copy of the code.
>>
>> Thanks,
>> Jeff
>>
>>
>> On Thu, Feb 5, 2009 at 1:08 PM, Martin Davis <[email protected]<mailto:
>> [email protected]>> wrote:
>>
>>    Another issue with ellipsoidal (geodetic) calculation is the whole
>>    date line/poles wrapping issue.  This is a major pain to deal
>>    with.  I guess local projections can be used to deal with this as
>>    well, though.
>>
>>    Seems like it would be nice to have a library that would
>>    automatically choose the best projection, do the transformation,
>>    compute the result, and untransform...
>>
>>
>>
>>    --    Martin Davis
>>    Senior Technical Architect
>>    Refractions Research, Inc.
>>    (250) 383-3022
>>
>>    _______________________________________________
>>    jts-devel mailing list
>>    [email protected]
>>    <mailto:[email protected]>
>>    http://lists.refractions.net/mailman/listinfo/jts-devel
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> jts-devel mailing list
>> [email protected]
>> http://lists.refractions.net/mailman/listinfo/jts-devel
>>
>>
>
> --
> Martin Davis
> Senior Technical Architect
> Refractions Research, Inc.
> (250) 383-3022
>
> _______________________________________________
> jts-devel mailing list
> [email protected]
> http://lists.refractions.net/mailman/listinfo/jts-devel
>
_______________________________________________
jts-devel mailing list
[email protected]
http://lists.refractions.net/mailman/listinfo/jts-devel

Reply via email to