Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm interested in pulling street view data at random within a country.

I can only figure out how to generate a point within a bounding box. Often it pulls data from nearby nations. I'm using a GIS server right now, but I'm interested in removing it from the workflow since it's a pain.

Anybody know of any javascript mapping API that can randomly generate a point within a complex polygon, such as a country boundary?

share|improve this question
1  
Is the Geoserver tag correct here? –  underdark Oct 26 '10 at 22:09
add comment

2 Answers 2

up vote 6 down vote accepted

"Random Google Street View. Teleport to a random point on the globe. Filter by country or continent. Share weird and wonderful places with your friends. Now with Antarctica, Brazil"

http://www.mapcrunch.com/

featured recently on http://googlemapsmania.blogspot.com/2010/10/random-google-maps.html

share|improve this answer
    
Thanks, I was already using an algorithm, that is mostly identical. Just trying to see if there was a faster way. –  Phil Salesses Oct 26 '10 at 1:54
add comment

There is a nice javascript implementation of the Ray casting algorithm on CloudDev

Using this it should be quite easy to:

//pseudocode
do 
  {create pt as a random point within the envelope}
until (pt is in poly)

An alternative approach if you are working with Google Maps might be the PointInPolygon test from AppDelegate

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.