Re: [racket-users] [OT] Cities and GPS

2019-09-08 Thread Laurent
This DB is even better:
http://download.geonames.org/export/


On Sun, Sep 8, 2019 at 8:34 AM Laurent  wrote:

> Nice :)
>
>
> On Sat, Sep 7, 2019 at 2:00 AM Alex Harsanyi 
> wrote:
>
>> In fact, I updated the data frame package to be able to read the CSV file
>> directly, without having to process it, so the example now becomes:
>>
>> #lang racket
>> (require data-frame)
>>
>> (define df (df-read/csv "worldcities.csv" #:quoted-numbers? #t))
>>
>> (define ((is-city? name) v)
>>   (equal? (vector-ref v 0) name))
>>
>> (df-select* df "city" "country" "lat" "lng" #:filter (is-city? "Perth"))
>>
>> ;; Produces:
>>
>> ;; '#(#("Perth" "Australia" -31.955 115.84)
>> ;;  #("Perth" "United Kingdom" 56.4003 -3.47))
>>
>> Alex.
>>
>>
>> On Saturday, September 7, 2019 at 8:13:28 AM UTC+8, Alex Harsanyi wrote:
>>>
>>>
>>> That database is simple enough to use directly, not sure if it needs a
>>> separate package:
>>>
>>> #lang racket
>>> (require data-frame)
>>>
>>> ;; The worldcities.csv file has all values quoted, so df-read/csv reads
>>> them
>>> ;; all as strings.  Convert a series to numbers.
>>> (define (->numeric df series)
>>>   (df-add-derived df series (list series) (lambda (v) (string->number (car
>>> v)
>>>
>>> (define df (df-read/csv "worldcities.csv"))
>>>
>>>   ;; Convert numeric series to numbers
>>> (for ([series '("lat" "lng" "population")])
>>>   (->numeric df series))
>>>
>>> (define ((is-city? name) v)
>>>   (equal? (vector-ref v 0) name))
>>>
>>> (df-select* df "city" "country" "lat" "lng" #:filter (is-city? "Perth"))
>>>
>>> ;; The above call produces:
>>>
>>> ;; '#(#("Perth" "Australia" -31.955 115.84)
>>> ;;#("Perth" "United Kingdom" 56.4003 -3.47))
>>>
>>>
>>>
>>> Alex.
>>>
>>> On Friday, September 6, 2019 at 8:37:59 PM UTC+8, Laurent wrote:

 There's a small free database here too:
 https://simplemaps.com/data/world-cities

 I started writing a simple query system for it this morning (csv->rktd,
 then just list of assoc operations).

 On Fri, Sep 6, 2019 at 1:35 PM Sage Gerard 
 wrote:

> Would geonames help?
> http://www.geonames.org/
>
>
>  Original Message 
> On Sep 6, 2019, 8:28 AM, Hendrik Boom < hen...@topoi.pooq.com> wrote:
>
>
> On Thu, Sep 05, 2019 at 10:42:01PM -0700, Alex Harsanyi wrote:
> ...
> >
> > >
> > > A package containing a database of the positions of the major
> cities and
> > > countries would be nice too :)
> > >
> >
> >
> > A general facility able to resolve location names to GPS coordinates
> would
> > be a lot of work, and I don't have time for such a thing. Sorry.
>
> There must be a GPS database of cities available somewhere already.
>
> -- hendrik
>
> --
> You received this message because you are subscribed to the Google
> Groups "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to racket...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/20190906122801.w5yhwfbzkods2fqr%40topoi.pooq.com.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to racket...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/yGI9c5OlIwdUQNOQy4KIEMKSfaYia4pr4LkSRukDwvb1sTFJfIQ1As6ca3i8jKqz42EV74CWvr4wdmfhQIcDtbniv7KDj4PqI0Giw-t9q_c%3D%40sagegerard.com
> 
> .
>
> --
>> You received this message because you are subscribed to the Google Groups
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to racket-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/racket-users/d4353473-061d-4651-aedc-425351833968%40googlegroups.com
>> 
>> .
>>
>

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


Re: [racket-users] [OT] Cities and GPS

2019-09-08 Thread Laurent
Nice :)


On Sat, Sep 7, 2019 at 2:00 AM Alex Harsanyi  wrote:

> In fact, I updated the data frame package to be able to read the CSV file
> directly, without having to process it, so the example now becomes:
>
> #lang racket
> (require data-frame)
>
> (define df (df-read/csv "worldcities.csv" #:quoted-numbers? #t))
>
> (define ((is-city? name) v)
>   (equal? (vector-ref v 0) name))
>
> (df-select* df "city" "country" "lat" "lng" #:filter (is-city? "Perth"))
>
> ;; Produces:
>
> ;; '#(#("Perth" "Australia" -31.955 115.84)
> ;;  #("Perth" "United Kingdom" 56.4003 -3.47))
>
> Alex.
>
>
> On Saturday, September 7, 2019 at 8:13:28 AM UTC+8, Alex Harsanyi wrote:
>>
>>
>> That database is simple enough to use directly, not sure if it needs a
>> separate package:
>>
>> #lang racket
>> (require data-frame)
>>
>> ;; The worldcities.csv file has all values quoted, so df-read/csv reads
>> them
>> ;; all as strings.  Convert a series to numbers.
>> (define (->numeric df series)
>>   (df-add-derived df series (list series) (lambda (v) (string->number (car
>> v)
>>
>> (define df (df-read/csv "worldcities.csv"))
>>
>>   ;; Convert numeric series to numbers
>> (for ([series '("lat" "lng" "population")])
>>   (->numeric df series))
>>
>> (define ((is-city? name) v)
>>   (equal? (vector-ref v 0) name))
>>
>> (df-select* df "city" "country" "lat" "lng" #:filter (is-city? "Perth"))
>>
>> ;; The above call produces:
>>
>> ;; '#(#("Perth" "Australia" -31.955 115.84)
>> ;;#("Perth" "United Kingdom" 56.4003 -3.47))
>>
>>
>>
>> Alex.
>>
>> On Friday, September 6, 2019 at 8:37:59 PM UTC+8, Laurent wrote:
>>>
>>> There's a small free database here too:
>>> https://simplemaps.com/data/world-cities
>>>
>>> I started writing a simple query system for it this morning (csv->rktd,
>>> then just list of assoc operations).
>>>
>>> On Fri, Sep 6, 2019 at 1:35 PM Sage Gerard  wrote:
>>>
 Would geonames help?
 http://www.geonames.org/


  Original Message 
 On Sep 6, 2019, 8:28 AM, Hendrik Boom < hen...@topoi.pooq.com> wrote:


 On Thu, Sep 05, 2019 at 10:42:01PM -0700, Alex Harsanyi wrote:
 ...
 >
 > >
 > > A package containing a database of the positions of the major
 cities and
 > > countries would be nice too :)
 > >
 >
 >
 > A general facility able to resolve location names to GPS coordinates
 would
 > be a lot of work, and I don't have time for such a thing. Sorry.

 There must be a GPS database of cities available somewhere already.

 -- hendrik

 --
 You received this message because you are subscribed to the Google
 Groups "Racket Users" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to racket...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/racket-users/20190906122801.w5yhwfbzkods2fqr%40topoi.pooq.com.

 --
 You received this message because you are subscribed to the Google
 Groups "Racket Users" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to racket...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/racket-users/yGI9c5OlIwdUQNOQy4KIEMKSfaYia4pr4LkSRukDwvb1sTFJfIQ1As6ca3i8jKqz42EV74CWvr4wdmfhQIcDtbniv7KDj4PqI0Giw-t9q_c%3D%40sagegerard.com
 
 .

 --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/d4353473-061d-4651-aedc-425351833968%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CABNTSaHJ%3DRWdnNqxrPG%2B-1vmm74%3DoxQxHXjwH--j%3D%3D673TWcaA%40mail.gmail.com.


Re: [racket-users] [OT] Cities and GPS

2019-09-06 Thread Alex Harsanyi
In fact, I updated the data frame package to be able to read the CSV file 
directly, without having to process it, so the example now becomes:

#lang racket
(require data-frame)

(define df (df-read/csv "worldcities.csv" #:quoted-numbers? #t))

(define ((is-city? name) v)
  (equal? (vector-ref v 0) name))

(df-select* df "city" "country" "lat" "lng" #:filter (is-city? "Perth"))

;; Produces:

;; '#(#("Perth" "Australia" -31.955 115.84)
;;  #("Perth" "United Kingdom" 56.4003 -3.47))

Alex.


On Saturday, September 7, 2019 at 8:13:28 AM UTC+8, Alex Harsanyi wrote:
>
>
> That database is simple enough to use directly, not sure if it needs a 
> separate package:
>
> #lang racket
> (require data-frame)
>
> ;; The worldcities.csv file has all values quoted, so df-read/csv reads 
> them
> ;; all as strings.  Convert a series to numbers.
> (define (->numeric df series)
>   (df-add-derived df series (list series) (lambda (v) (string->number (car 
> v)
>   
> (define df (df-read/csv "worldcities.csv"))
>
>   ;; Convert numeric series to numbers
> (for ([series '("lat" "lng" "population")])
>   (->numeric df series))
>
> (define ((is-city? name) v)
>   (equal? (vector-ref v 0) name))
>
> (df-select* df "city" "country" "lat" "lng" #:filter (is-city? "Perth"))
>
> ;; The above call produces:
>
> ;; '#(#("Perth" "Australia" -31.955 115.84)
> ;;#("Perth" "United Kingdom" 56.4003 -3.47))
>
>
>
> Alex.
>
> On Friday, September 6, 2019 at 8:37:59 PM UTC+8, Laurent wrote:
>>
>> There's a small free database here too:
>> https://simplemaps.com/data/world-cities
>>
>> I started writing a simple query system for it this morning (csv->rktd, 
>> then just list of assoc operations). 
>>
>> On Fri, Sep 6, 2019 at 1:35 PM Sage Gerard  wrote:
>>
>>> Would geonames help? 
>>> http://www.geonames.org/
>>>
>>>
>>>  Original Message 
>>> On Sep 6, 2019, 8:28 AM, Hendrik Boom < hen...@topoi.pooq.com> wrote:
>>>
>>>
>>> On Thu, Sep 05, 2019 at 10:42:01PM -0700, Alex Harsanyi wrote:
>>> ...
>>> >
>>> > >
>>> > > A package containing a database of the positions of the major cities 
>>> and
>>> > > countries would be nice too :)
>>> > >
>>> >
>>> >
>>> > A general facility able to resolve location names to GPS coordinates 
>>> would
>>> > be a lot of work, and I don't have time for such a thing. Sorry.
>>>
>>> There must be a GPS database of cities available somewhere already.
>>>
>>> -- hendrik
>>>
>>> --
>>> You received this message because you are subscribed to the Google 
>>> Groups "Racket Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to racket...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/racket-users/20190906122801.w5yhwfbzkods2fqr%40topoi.pooq.com.
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Racket Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to racket...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/racket-users/yGI9c5OlIwdUQNOQy4KIEMKSfaYia4pr4LkSRukDwvb1sTFJfIQ1As6ca3i8jKqz42EV74CWvr4wdmfhQIcDtbniv7KDj4PqI0Giw-t9q_c%3D%40sagegerard.com
>>>  
>>> 
>>> .
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/d4353473-061d-4651-aedc-425351833968%40googlegroups.com.


Re: [racket-users] [OT] Cities and GPS

2019-09-06 Thread Alex Harsanyi

That database is simple enough to use directly, not sure if it needs a 
separate package:

#lang racket
(require data-frame)

;; The worldcities.csv file has all values quoted, so df-read/csv reads them
;; all as strings.  Convert a series to numbers.
(define (->numeric df series)
  (df-add-derived df series (list series) (lambda (v) (string->number (car v
)
  
(define df (df-read/csv "worldcities.csv"))

  ;; Convert numeric series to numbers
(for ([series '("lat" "lng" "population")])
  (->numeric df series))

(define ((is-city? name) v)
  (equal? (vector-ref v 0) name))

(df-select* df "city" "country" "lat" "lng" #:filter (is-city? "Perth"))

;; The above call produces:

;; '#(#("Perth" "Australia" -31.955 115.84)
;;#("Perth" "United Kingdom" 56.4003 -3.47))



Alex.

On Friday, September 6, 2019 at 8:37:59 PM UTC+8, Laurent wrote:
>
> There's a small free database here too:
> https://simplemaps.com/data/world-cities
>
> I started writing a simple query system for it this morning (csv->rktd, 
> then just list of assoc operations). 
>
> On Fri, Sep 6, 2019 at 1:35 PM Sage Gerard  > wrote:
>
>> Would geonames help? 
>> http://www.geonames.org/
>>
>>
>>  Original Message 
>> On Sep 6, 2019, 8:28 AM, Hendrik Boom < hen...@topoi.pooq.com 
>> > wrote:
>>
>>
>> On Thu, Sep 05, 2019 at 10:42:01PM -0700, Alex Harsanyi wrote:
>> ...
>> >
>> > >
>> > > A package containing a database of the positions of the major cities 
>> and
>> > > countries would be nice too :)
>> > >
>> >
>> >
>> > A general facility able to resolve location names to GPS coordinates 
>> would
>> > be a lot of work, and I don't have time for such a thing. Sorry.
>>
>> There must be a GPS database of cities available somewhere already.
>>
>> -- hendrik
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to racket...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/racket-users/20190906122801.w5yhwfbzkods2fqr%40topoi.pooq.com.
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to racket...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/racket-users/yGI9c5OlIwdUQNOQy4KIEMKSfaYia4pr4LkSRukDwvb1sTFJfIQ1As6ca3i8jKqz42EV74CWvr4wdmfhQIcDtbniv7KDj4PqI0Giw-t9q_c%3D%40sagegerard.com
>>  
>> 
>> .
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/f22d810c-68bf-419f-8009-5ca4ce421ea5%40googlegroups.com.


Re: [racket-users] [OT] Cities and GPS

2019-09-06 Thread Laurent
There's a small free database here too:
https://simplemaps.com/data/world-cities

I started writing a simple query system for it this morning (csv->rktd,
then just list of assoc operations).

On Fri, Sep 6, 2019 at 1:35 PM Sage Gerard  wrote:

> Would geonames help?
> http://www.geonames.org/
>
>
>  Original Message 
> On Sep 6, 2019, 8:28 AM, Hendrik Boom < hend...@topoi.pooq.com> wrote:
>
>
> On Thu, Sep 05, 2019 at 10:42:01PM -0700, Alex Harsanyi wrote:
> ...
> >
> > >
> > > A package containing a database of the positions of the major cities
> and
> > > countries would be nice too :)
> > >
> >
> >
> > A general facility able to resolve location names to GPS coordinates
> would
> > be a lot of work, and I don't have time for such a thing. Sorry.
>
> There must be a GPS database of cities available somewhere already.
>
> -- hendrik
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/20190906122801.w5yhwfbzkods2fqr%40topoi.pooq.com.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/yGI9c5OlIwdUQNOQy4KIEMKSfaYia4pr4LkSRukDwvb1sTFJfIQ1As6ca3i8jKqz42EV74CWvr4wdmfhQIcDtbniv7KDj4PqI0Giw-t9q_c%3D%40sagegerard.com
> 
> .
>
>

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


Re: [racket-users] [OT] Cities and GPS

2019-09-06 Thread Sage Gerard
Would geonames help?
http://www.geonames.org/

 Original Message 
On Sep 6, 2019, 8:28 AM, Hendrik Boom wrote:

> On Thu, Sep 05, 2019 at 10:42:01PM -0700, Alex Harsanyi wrote:
> ...
>>
>> >
>> > A package containing a database of the positions of the major cities and
>> > countries would be nice too :)
>> >
>>
>>
>> A general facility able to resolve location names to GPS coordinates would
>> be a lot of work, and I don't have time for such a thing. Sorry.
>
> There must be a GPS database of cities available somewhere already.
>
> -- hendrik
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/20190906122801.w5yhwfbzkods2fqr%40topoi.pooq.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/yGI9c5OlIwdUQNOQy4KIEMKSfaYia4pr4LkSRukDwvb1sTFJfIQ1As6ca3i8jKqz42EV74CWvr4wdmfhQIcDtbniv7KDj4PqI0Giw-t9q_c%3D%40sagegerard.com.