4
I need to find the starting point and end of CEP latitude/longitude. I need to analyze on average a latitude and longitude and this initial and final parameter would show whether this coordinate is part of the CEP or not. Lately I’m having problems with geolocation API’s and I’m planning to set up a Mysql database with all the zip codes of the streets of my city and averages of latitudes/longitudes to compare with the latitude and longitude I will search in the bank.
I have to get these averages to avoid more than 1 million queries via API per day!
So I want to create this field of average that could be the sum of latitude and longitude or the product to already quickly check in which CEP band that coordinate is. I know that in different localities this gross average may have repetitions but as my focus is on only one city I believe it will not occur.
Is there any way to achieve the initial and final co-ordination of a CEP?
Example:
latitude = -15.8008398
longitude = -47.86135561
produto = latitude * longitude = (756.2496126044413)
banco = {
coord_inicial: 750.390348041, (??? Número que preciso encontrar)
coord_final : 760.230192319, (??? Número que preciso encontrar)
cep : 70100000,
logradouro : 'Praça dos três poderes',
cidade : 'Brasília'
}
If the product is between initial cohort and the final cohort this location belongs to the CEP.
Man, this problem of yours seems to be a lot more serious than it looks to solve with average coordinates. I say this because: 1) Hardly a street is straight, so the average would not be exactly useful. 2) A map works on a Cartesian plane, so it would be more useful to keep a formula for a line, then calculate the distance of a point on that line and see if this distance is within an acceptable limit. But I still don’t think it would solve your problem.
– fernandosavio
– fernandosavio
@fernandosavio I’m really looking for some way to store repeated data in the database to avoid so many requests in geolocation Apis. It’s an initial idea of my average, I already knew that it would be much more complex to solve with a simple average, but as you said, would I get a sort of limit calculating the distance between these points in the Cartesian plan? Thanks for the tip, I will now study this alternative.
– Matheus do Carmo
I was thinking now... maybe an alternative is to do the opposite, register lat and long zones with their radius or quadrant and register the strains that are within that area
– Leandro Angelo
@Leandroangelo This is exactly what I was thinking at the weekend, I already downloaded the data from Brazil in osm.pbf format to be generating my own map in closed environment, I will see if it is possible through this API: openstreetmap
– Matheus do Carmo