Re: [go-nuts] Re: Where is the middle of Brazil?

2019-12-11 Thread JuciÊ Andrade
A Brazilian friend from the C++ group accepted your challenge and found the 
population center. It's here:

https://goo.gl/maps/uNSA95Ej4PYLzvgp7

On Saturday, December 7, 2019 at 8:12:28 PM UTC-3, Marcin Romaszewicz wrote:
>
> As a bonus challenge, try to compute the population center of Brazil :)
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/7193f7bf-ebcb-4139-8edf-dc8a2d896da0%40googlegroups.com.


Re: [go-nuts] Re: Where is the middle of Brazil?

2019-12-07 Thread Marcin Romaszewicz
As a bonus challenge, try to compute the population center of Brazil :) One
way of finding the center is minimizing the integral of all distances to a
point, but for population, these points now have weight.

Like Michael above, I spent years working on Google Earth, and the code
running in the latest Earth client app for doing label placement, polygon
placement and center finding is my code. It's fun stuff!

-- Marcin



On Sat, Dec 7, 2019 at 11:05 AM JuciÊ Andrade  wrote:

> Yes, I understand it is impossible to chose the "correct way" of
> determining the center. This week I learnt there are at least a handful of
> places claiming to be the "center" of Brazil, with monuments and whatnot.
>
> The search for a solution is an interesting endeavor per se. Programming
> is supposed to be fun after all.
>
> Several things amazed me:
> . the variety of proposed methods. A guy in Germany collected the position
> and area of every county in Brazil and proceeded with the math. Another guy
> proposed to draw a map on carton paper, cut it and find the center of
> gravity. Etc;
> . the rich geographical data available for anyone to use;
> . the language packages and libraries to handle geographical data;
> . the enviable knowledge some people have on the matter;
> . the willing to learn a new topic just for the sake of it;
> . the unwillingness to learn a new topic just for the sake of it;
>
> Anyway, it was a delightful experience. Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/26ee692b-1807-46cd-b211-90f07af9d631%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CA%2Bv29LsRcs66O7B7zq9xx%3DEbdJSHDZLty4Q1srE%3DXZW0VJhhxA%40mail.gmail.com.


Re: [go-nuts] Re: Where is the middle of Brazil?

2019-12-07 Thread JuciÊ Andrade
Yes, I understand it is impossible to chose the "correct way" of 
determining the center. This week I learnt there are at least a handful of 
places claiming to be the "center" of Brazil, with monuments and whatnot.

The search for a solution is an interesting endeavor per se. Programming is 
supposed to be fun after all.

Several things amazed me:
. the variety of proposed methods. A guy in Germany collected the position 
and area of every county in Brazil and proceeded with the math. Another guy 
proposed to draw a map on carton paper, cut it and find the center of 
gravity. Etc;
. the rich geographical data available for anyone to use;
. the language packages and libraries to handle geographical data;
. the enviable knowledge some people have on the matter;
. the willing to learn a new topic just for the sake of it;
. the unwillingness to learn a new topic just for the sake of it;

Anyway, it was a delightful experience. Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/26ee692b-1807-46cd-b211-90f07af9d631%40googlegroups.com.


Re: [go-nuts] Re: Where is the middle of Brazil?

2019-12-07 Thread Michael Jones
...now *this* is something that I know a great deal about (resulting in
label placement in Google Maps and Google Earth, discussions with
colleagues in USGS, the US Census Bureau, DoD, the United Nations GGIM
experts group, UK Ordnance Survey, Survey of India, etc.)

Indeed most of the issues Andrey shared are significant, though the final
note about "which map projection to use" is very odd. The "geographic
center" however one might define it, is a geographic concept concerning
place and not a cartographic concept concerning boundaries after
projection. The computation only has its natural meaning on the globe.

The typical choice is the lat-lon midpoint of the contiguous landmass
(easy) or major aggregate areas (more handwavy) such as would be the case
in Michigan

in the United States. Note that the link shows the two major areas as well
as a large Isle Royale National Park to the north. The question being to
include it or not. The same issue arises with Stewart Island in New Zealand.

There is a pragmatic issue as well--the center may not be in the geographic
entity at all! Imagine a 'C' shaped land. Such a land mass will have a
center, computed by any reasonable means, that is in the empty center and
not in the surrounding ring. Does this happen? Yes, thousands of times
.
Note the placement of "Molokini Shoal Marine Life Conservation District"
compared to the "Molokini" point of interest label--any "center" is along
the line segment between these yet most are offshore. Same in Ecuador with
its Galápagos Islands, where the midpoint is in the ocean. (The same thing
happens with 'L' shaped regions, such as Florida in the United States, and
hook or curved places including Cuba, Laos, Vietnam, and Norway.)

The story of Richard Feynman's travels to the center of Asia
 is chronicled
in Ralph Leighton's delightful book "Tuva or Bust.
"
(Note that at least three places are claimed as the center of Asia.)

On Sat, Dec 7, 2019 at 8:38 AM andrey mirtchovski 
wrote:

> this is quickly becoming off-topic. however, from
> https://en.wikipedia.org/wiki/Geographical_centre:
>
> "As noted in a USGS document "There is no generally accepted
> definition of geographic center, and no completely satisfactory method
> for determining it."[1]
>
> In general, there is room for debate around various details such as
> whether or not to include islands and similarly, large bodies of
> water, how best to handle the curvature of the Earth (a more
> significant factor with larger regions) and closely related to that
> issue, which map projection to use."
> --
> [1]: https://pubs.er.usgs.gov/publication/70039437
>
> On Sat, Dec 7, 2019 at 9:32 AM JuciÊ Andrade  wrote:
> >
> > If one wants to improve precision she may use a bigger map.
> > The resulting position would be the same, only more accurate.
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "golang-nuts" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to golang-nuts+unsubscr...@googlegroups.com.
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/270e41e1-5dd5-4351-be8a-1ba683bdd6a8%40googlegroups.com
> .
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/CAK4xykV5zOMW%2Bbv3DWb1pTXad-rieqnYdoop6dpJwmsnkkGx2w%40mail.gmail.com
> .
>


-- 

*Michael T. jonesmichael.jo...@gmail.com *

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CALoEmQzm1V3FUaQ0PYfaKwY0wkk1rwRZcZjub_08hgdfkLJFrw%40mail.gmail.com.


Re: [go-nuts] Re: Where is the middle of Brazil?

2019-12-07 Thread andrey mirtchovski
this is quickly becoming off-topic. however, from
https://en.wikipedia.org/wiki/Geographical_centre:

"As noted in a USGS document "There is no generally accepted
definition of geographic center, and no completely satisfactory method
for determining it."[1]

In general, there is room for debate around various details such as
whether or not to include islands and similarly, large bodies of
water, how best to handle the curvature of the Earth (a more
significant factor with larger regions) and closely related to that
issue, which map projection to use."
--
[1]: https://pubs.er.usgs.gov/publication/70039437

On Sat, Dec 7, 2019 at 9:32 AM JuciÊ Andrade  wrote:
>
> If one wants to improve precision she may use a bigger map.
> The resulting position would be the same, only more accurate.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/golang-nuts/270e41e1-5dd5-4351-be8a-1ba683bdd6a8%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAK4xykV5zOMW%2Bbv3DWb1pTXad-rieqnYdoop6dpJwmsnkkGx2w%40mail.gmail.com.


Re: [go-nuts] Re: Where is the middle of Brazil?

2019-12-07 Thread JuciÊ Andrade
If one wants to improve precision she may use a bigger map.
The resulting position would be the same, only more accurate.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/270e41e1-5dd5-4351-be8a-1ba683bdd6a8%40googlegroups.com.


Re: [go-nuts] Re: Where is the middle of Brazil?

2019-12-07 Thread JuciÊ Andrade
Hi, Jan.

As you can imagine, there are several ways to define "middle". So, to get 
rid of the ambiguity I picked this one: "the position would divide Brazil 
so that half of our country area would be to the north and half to the 
south, while half would be to the west and half to the east."

On Saturday, December 7, 2019 at 11:30:42 AM UTC-3, Jan Mercl wrote:

> This method resembles determining the CG, but only very approximately. 
> How is your "middle" actually defined? 
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/c96d3e86-fd76-4489-a58c-1378198858df%40googlegroups.com.


Re: [go-nuts] Re: Where is the middle of Brazil?

2019-12-07 Thread Jan Mercl
On Sat, Dec 7, 2019 at 2:34 PM JuciÊ Andrade  wrote:

> I am pretty sure there are other ways to do it, but the method I devised is 
> simple and produces a good enough result. If somebody can put a hole in my 
> reasoning, feel free to do so.
>
> All the info I need are in a map, OK? So I downloaded a map from the 
> Internet. I choose a map that shows only the territory I am interested in and 
> nothing else:
>
> http://www.temasactuales.com/temasblog/wp-content/Images/mapa_do_brasil.gif
>
> The method goes like this: I scan the image counting every pixel that is not 
> background color. It gives my territory area. Then I divide that by 2 to 
> obtain half the area.
>
> I scan the image again from top to bottom, stopping when I reach half the 
> area. I draw a horizontal line dividing north and south. Finally I scan the 
> image from left to right stopping at half area and draw a vertical line 
> dividing east from west. The point I am interested in is in the intersection 
> of those two lines.

This method resembles determining the CG, but only very approximately.
How is your "middle" actually defined?

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAA40n-X_k0KyGrM77kBRUSkrUOLNSPn-0Rk9LGbCeoxkmYJ5Rg%40mail.gmail.com.


[go-nuts] Re: Where is the middle of Brazil?

2019-12-07 Thread JuciÊ Andrade
I am pretty sure there are other ways to do it, but the method I devised is 
simple and produces a good enough result. If somebody can put a hole in my 
reasoning, feel free to do so.

All the info I need are in a map, OK? So I downloaded a map from the 
Internet. I choose a map that shows only the territory I am interested in 
and nothing else:

http://www.temasactuales.com/temasblog/wp-content/Images/mapa_do_brasil.gif

The method goes like this: I scan the image counting every pixel that is 
not background color. It gives my territory area. Then I divide that by 2 
to obtain half the area.

I scan the image again from top to bottom, stopping when I reach half the 
area. I draw a horizontal line dividing north and south. Finally I scan the 
image from left to right stopping at half area and draw a vertical line 
dividing east from west. The point I am interested in is in the 
intersection of those two lines.

My Go program has some small optimizations so that I don't have to actually 
scan the image so many times, but the idea is the same.

The resulting image:
https://drive.google.com/file/d/163K79BWKRTmI3BOIMUsPf7ziISwt-R3z/view?usp=sharing

The github repo:
https://github.com/jucie/geomedian

The file I used to calculate the digest in the first message is attached.

Thank you, my friends, I hope you enjoyed the challenge.

MD5 SHA-1

--

4c021557d057327f2977dd739b67da6b b3913154ca0c5f48f3555c536fc987322169e607 
ihavetheanswer.txt

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/4af4cd54-5994-49b4-9f48-e9cfd3e7271a%40googlegroups.com.
The geographic median of Brazil is in Para's south region, as can be verified 
using my program geomedian, available in github.


[go-nuts] Re: Where is the middle of Brazil?

2019-12-07 Thread JuciÊ Andrade
OK, people. It has been nearly a week since I left the programming 
challenge here, so let me show my approach.

First, let me tell you guys I sent the aforementioned challenge to a few 
programming groups and it went like this:
. some very knowledgeable people in this group tried to find a solution. 
That made me proud, as I told you;
. brazilian C++ group: a bunch of guys fiercely tried to solve the problem 
and a few succeeded to some extent;
. brazilian Go group: too small a group, people prefer interacting thru 
Slack. So, no responses;
. Rust official users group right away classified my message as "off 
topic", hide it, and not so politely said I should "post it elsewhere";

My next message will show the answer. So, if you wanna keep trying please 
stop here.


-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/7ea1558a-75f2-4371-8db1-b99bad168de2%40googlegroups.com.


[go-nuts] Re: Where is the middle of Brazil?

2019-11-30 Thread Rodolfo Azevedo
Bixo vai dormir, isso né hora pra loucura não...  hehehehehe

Em sábado, 30 de novembro de 2019 21:30:33 UTC-4, JuciÊ Andrade escreveu:
>
> When I was a kid I asked my teacher why my country capital had been moved 
> from Rio de Janeiro to Brasilia. She said the reason was Brasilia is right 
> in the middle of our territory, that way our president could take care of 
> our entire country more effectively. I accepted that answer. Many years 
> later, contemplating a map, I doubted Brasilia is right in the middle.
>
>
> Where is the middle of Brazil?
>
>
> MD5 SHA-1
>
> --
>
> 4c021557d057327f2977dd739b67da6b b3913154ca0c5f48f3555c536fc987322169e607 
> ihavetheanswer.txt
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/0ff45383-2d11-44f4-8f01-0e8011398d33%40googlegroups.com.