Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I have to write a function that takes in an array of zipcodes and only returns the ones that do not produce super overlappy visualizations if a circle was drawn around the zipcode of a fixed radius. So basically my function takes in array of zipcodes and a radius variable.
What are some algorithms I can use to produce non overlappy maps?
Here is a messed up visualization:
Here is a correct one.
One algorithm that I came up was to basically loop through the zip code array one zip at a time and then determine the distance to other zipcodes in the array center using the provided lat / lon coordinates and then finding all the zips that are intersected. However As you can imagine that it is not a perfect implementation as some overlap is OK and also my algorithm would assume perfect circles.
Is there a common sense algorithm that I am missing? Just trying to learn.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I know how to use the sun info function to get some info about the sun, but it doesn't offer a way to get the azimuth for a given date/time/location. Specifically, I want to get the azimuth at sunset to display in a graph where I show the length of day and sunrise/sunset.
I've seen at least one answer that partially applies, but it's a long and complicated function that calculates a whole lot of things I don't need. Since I'll need to calculate the azimuth for 365 days, I think this will add a lot of processor load and time in generating the chart.
I'm hoping for a simpler formula that will provide just the azimuth for a lat/long and timestamp.
You can use a tiny PHP library called SunCalc. SunCalc is a tiny PHP library for calculating sun position, sunlight phases (times for sunrise, sunset, dusk, etc.)
Here you can find the lib and exemples : Source
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I'm using Parse.com for my back-end, and in my table I have column named geopoint whose time type is GeoPoint. In another table I have the same. So I need to calculate distance between those two geopoints. Is there way to do that with parse? Or you can provide another solution. I'm using PHP
Without any code snippets it would be hard to give you the answer. I can point you in the right direction though.
As you are only using 2 points I assume you want Euclidean distance. (Straight line or 'as the crow flies')?
Wolfram has an excellent page on this here: http://mathworld.wolfram.com/Distance.html
It is (slightly) simplified here too: http://www.cut-the-knot.org/pythagoras/DistanceFormula.shtml
If you are still having trouble then post code snippets. Ideally something where you are already accessing these objects.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have a database of national park names (Alcatraz Island, Death Valley, Biscayne, etc.) which all have coordinates.
What's the simplest way for me to match the closest park in my database to their current location whether on a mobile device or on a desktop?
You can definitely use Google's Geolocation API to get the user's current location, then with some Javascript, you can determine the closest park.
Don't know what database you're using, but you might look into PostGIS, an extension to Postgres designed to handle geographical data. You would be able to query the database for the closest locations to a certain point. The algorithms for doing so are built in to PostGIS. Otherwise, you might need an external library to do the calculations.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I create simple API for IOS devices. In my project there is a table with the parties the latitude and longitude where they registered. The device gives me the latitude and longitude where it is and I have him return The list of parties that are closer to it within such km. How best to do this, please help and thanks.
I use clean PHP and mysql.
Write a user defined function in mysql [e.g. distance(x1,y1,x2,y2)] which returns the distance of two points. Then you can query for other locations within a given radius of a given point, like in
select parties from mytable where distance(latitude,longitude,x,y) < 10
Do the processing in the database, not in the PHP client, for performance reasons.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm trying to find research or information as to whether searching for a location by postcode in a web system is more accurate that longitude and latitude values. I am trying to justify why I have chosen the postcode method instead of the longitude and latitude values, or research/information backing up that statement.
I can't seem to find a lot of information regarding it.
Latitude and longitude, with enough precision, can point to any place on Earth, including places outside national boundaries that have no postal codes. Postal codes, on the other hand, are arbitrary boundaries that are unlikely to be available in, say, Antarctica or the Indian Ocean. You use postal codes because most people are familiar with their local postal codes and can fill them into a form, where they probably can't tell you what their local lat/long coordinates are without tools - and those tools may require them to be able to read a map, which some people can't do very well.