Downloading Geonames












0















I am interested in downloading Lake Geonames for Canada. Max. rows that can be downloaded per day is 1000. When I run the below code, few records are being missed and some records are overlapped. Is there a way to get total number of lake geonames records available and download the record only once without any overlap ?



library(geonames); GN_lake <- GNsearch(featureCode='LK', country='CA',startRow=1,maxRows = 1000) 


GN_lake <- GNsearch(featureCode='LK', country='CA',startRow=1000, maxRows=1000)










share|improve this question



























    0















    I am interested in downloading Lake Geonames for Canada. Max. rows that can be downloaded per day is 1000. When I run the below code, few records are being missed and some records are overlapped. Is there a way to get total number of lake geonames records available and download the record only once without any overlap ?



    library(geonames); GN_lake <- GNsearch(featureCode='LK', country='CA',startRow=1,maxRows = 1000) 


    GN_lake <- GNsearch(featureCode='LK', country='CA',startRow=1000, maxRows=1000)










    share|improve this question

























      0












      0








      0








      I am interested in downloading Lake Geonames for Canada. Max. rows that can be downloaded per day is 1000. When I run the below code, few records are being missed and some records are overlapped. Is there a way to get total number of lake geonames records available and download the record only once without any overlap ?



      library(geonames); GN_lake <- GNsearch(featureCode='LK', country='CA',startRow=1,maxRows = 1000) 


      GN_lake <- GNsearch(featureCode='LK', country='CA',startRow=1000, maxRows=1000)










      share|improve this question














      I am interested in downloading Lake Geonames for Canada. Max. rows that can be downloaded per day is 1000. When I run the below code, few records are being missed and some records are overlapped. Is there a way to get total number of lake geonames records available and download the record only once without any overlap ?



      library(geonames); GN_lake <- GNsearch(featureCode='LK', country='CA',startRow=1,maxRows = 1000) 


      GN_lake <- GNsearch(featureCode='LK', country='CA',startRow=1000, maxRows=1000)







      r geonames






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 21 '18 at 12:54









      roshualineroshualine

      1316




      1316
























          1 Answer
          1






          active

          oldest

          votes


















          0














          Why not just work with the CA database locally?



          library(httr)
          library(tidyverse)

          # Get CA database
          httr::GET(
          url = "http://download.geonames.org/export/dump/CA.zip",
          httr::write_disk("CA.zip"),
          httr::progress()
          ) -> res

          # unzip it
          unzip("CA.zip")

          read.csv( # readr::read_tsv doesn't like this file at least when I read it
          file = "CA.txt",
          header = FALSE,
          sep = "t",
          col.names = c(
          "geonameid", "name", "asciiname", "alternatenames", "latitude",
          "longitude", "feature_class", "feature_code", "country", "cc2",
          "admin1_code1", "admin2_code", "admin3_code", "admin4_code",
          "population", "elevation", "dem", "timezone", "modification_date"
          ),
          stringsAsFactors = FALSE
          ) %>% tbl_df() -> ca_geo

          filter(ca_geo, feature_code == "LK")
          ## # A tibble: 104,663 x 19
          ## geonameid name asciiname alternatenames latitude longitude
          ## <int> <chr> <chr> <chr> <dbl> <dbl>
          ## 1 5881640 101 Mile Lake 101 Mile Lake "" 51.7 -121.
          ## 2 5881642 103 Mile Lake 103 Mile Lake "" 51.7 -121.
          ## 3 5881644 105 Mile Lake 105 Mile Lake "" 51.7 -121.
          ## 4 5881647 108 Mile Lake 108 Mile Lake "" 51.7 -121.
          ## 5 5881660 130 Mile Lake 130 Mile Lake "" 51.9 -122.
          ## 6 5881666 16 1/2 Mile … 16 1/2 Mile … "" 52.7 -118.
          ## 7 5881668 180 Lake 180 Lake "" 57.4 -130.
          ## 8 5881673 {1}útsaw Lake {1}utsaw Lake "" 62.7 -137.
          ## 9 5881680 24 Mile Lake 24 Mile Lake "" 46.5 -82.0
          ## 10 5881683 28 Mile Lake 28 Mile Lake "" 54.8 -124.
          ## # ... with 104,653 more rows, and 13 more variables: feature_class <chr>,
          ## # feature_code <chr>, country <chr>, cc2 <chr>, admin1_code1 <int>,
          ## # admin2_code <chr>, admin3_code <int>, admin4_code <chr>,
          ## # population <int>, elevation <int>, dem <int>, timezone <chr>,
          ## # modification_date <chr>





          share|improve this answer
























          • Thank you very much. This is a better solution than what I planned.

            – roshualine
            Nov 21 '18 at 13:59











          • 👍🏼 download.geonames.org/export/dump has all the databases and metadata about them.

            – hrbrmstr
            Nov 21 '18 at 14:06











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53412488%2fdownloading-geonames%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          Why not just work with the CA database locally?



          library(httr)
          library(tidyverse)

          # Get CA database
          httr::GET(
          url = "http://download.geonames.org/export/dump/CA.zip",
          httr::write_disk("CA.zip"),
          httr::progress()
          ) -> res

          # unzip it
          unzip("CA.zip")

          read.csv( # readr::read_tsv doesn't like this file at least when I read it
          file = "CA.txt",
          header = FALSE,
          sep = "t",
          col.names = c(
          "geonameid", "name", "asciiname", "alternatenames", "latitude",
          "longitude", "feature_class", "feature_code", "country", "cc2",
          "admin1_code1", "admin2_code", "admin3_code", "admin4_code",
          "population", "elevation", "dem", "timezone", "modification_date"
          ),
          stringsAsFactors = FALSE
          ) %>% tbl_df() -> ca_geo

          filter(ca_geo, feature_code == "LK")
          ## # A tibble: 104,663 x 19
          ## geonameid name asciiname alternatenames latitude longitude
          ## <int> <chr> <chr> <chr> <dbl> <dbl>
          ## 1 5881640 101 Mile Lake 101 Mile Lake "" 51.7 -121.
          ## 2 5881642 103 Mile Lake 103 Mile Lake "" 51.7 -121.
          ## 3 5881644 105 Mile Lake 105 Mile Lake "" 51.7 -121.
          ## 4 5881647 108 Mile Lake 108 Mile Lake "" 51.7 -121.
          ## 5 5881660 130 Mile Lake 130 Mile Lake "" 51.9 -122.
          ## 6 5881666 16 1/2 Mile … 16 1/2 Mile … "" 52.7 -118.
          ## 7 5881668 180 Lake 180 Lake "" 57.4 -130.
          ## 8 5881673 {1}útsaw Lake {1}utsaw Lake "" 62.7 -137.
          ## 9 5881680 24 Mile Lake 24 Mile Lake "" 46.5 -82.0
          ## 10 5881683 28 Mile Lake 28 Mile Lake "" 54.8 -124.
          ## # ... with 104,653 more rows, and 13 more variables: feature_class <chr>,
          ## # feature_code <chr>, country <chr>, cc2 <chr>, admin1_code1 <int>,
          ## # admin2_code <chr>, admin3_code <int>, admin4_code <chr>,
          ## # population <int>, elevation <int>, dem <int>, timezone <chr>,
          ## # modification_date <chr>





          share|improve this answer
























          • Thank you very much. This is a better solution than what I planned.

            – roshualine
            Nov 21 '18 at 13:59











          • 👍🏼 download.geonames.org/export/dump has all the databases and metadata about them.

            – hrbrmstr
            Nov 21 '18 at 14:06
















          0














          Why not just work with the CA database locally?



          library(httr)
          library(tidyverse)

          # Get CA database
          httr::GET(
          url = "http://download.geonames.org/export/dump/CA.zip",
          httr::write_disk("CA.zip"),
          httr::progress()
          ) -> res

          # unzip it
          unzip("CA.zip")

          read.csv( # readr::read_tsv doesn't like this file at least when I read it
          file = "CA.txt",
          header = FALSE,
          sep = "t",
          col.names = c(
          "geonameid", "name", "asciiname", "alternatenames", "latitude",
          "longitude", "feature_class", "feature_code", "country", "cc2",
          "admin1_code1", "admin2_code", "admin3_code", "admin4_code",
          "population", "elevation", "dem", "timezone", "modification_date"
          ),
          stringsAsFactors = FALSE
          ) %>% tbl_df() -> ca_geo

          filter(ca_geo, feature_code == "LK")
          ## # A tibble: 104,663 x 19
          ## geonameid name asciiname alternatenames latitude longitude
          ## <int> <chr> <chr> <chr> <dbl> <dbl>
          ## 1 5881640 101 Mile Lake 101 Mile Lake "" 51.7 -121.
          ## 2 5881642 103 Mile Lake 103 Mile Lake "" 51.7 -121.
          ## 3 5881644 105 Mile Lake 105 Mile Lake "" 51.7 -121.
          ## 4 5881647 108 Mile Lake 108 Mile Lake "" 51.7 -121.
          ## 5 5881660 130 Mile Lake 130 Mile Lake "" 51.9 -122.
          ## 6 5881666 16 1/2 Mile … 16 1/2 Mile … "" 52.7 -118.
          ## 7 5881668 180 Lake 180 Lake "" 57.4 -130.
          ## 8 5881673 {1}útsaw Lake {1}utsaw Lake "" 62.7 -137.
          ## 9 5881680 24 Mile Lake 24 Mile Lake "" 46.5 -82.0
          ## 10 5881683 28 Mile Lake 28 Mile Lake "" 54.8 -124.
          ## # ... with 104,653 more rows, and 13 more variables: feature_class <chr>,
          ## # feature_code <chr>, country <chr>, cc2 <chr>, admin1_code1 <int>,
          ## # admin2_code <chr>, admin3_code <int>, admin4_code <chr>,
          ## # population <int>, elevation <int>, dem <int>, timezone <chr>,
          ## # modification_date <chr>





          share|improve this answer
























          • Thank you very much. This is a better solution than what I planned.

            – roshualine
            Nov 21 '18 at 13:59











          • 👍🏼 download.geonames.org/export/dump has all the databases and metadata about them.

            – hrbrmstr
            Nov 21 '18 at 14:06














          0












          0








          0







          Why not just work with the CA database locally?



          library(httr)
          library(tidyverse)

          # Get CA database
          httr::GET(
          url = "http://download.geonames.org/export/dump/CA.zip",
          httr::write_disk("CA.zip"),
          httr::progress()
          ) -> res

          # unzip it
          unzip("CA.zip")

          read.csv( # readr::read_tsv doesn't like this file at least when I read it
          file = "CA.txt",
          header = FALSE,
          sep = "t",
          col.names = c(
          "geonameid", "name", "asciiname", "alternatenames", "latitude",
          "longitude", "feature_class", "feature_code", "country", "cc2",
          "admin1_code1", "admin2_code", "admin3_code", "admin4_code",
          "population", "elevation", "dem", "timezone", "modification_date"
          ),
          stringsAsFactors = FALSE
          ) %>% tbl_df() -> ca_geo

          filter(ca_geo, feature_code == "LK")
          ## # A tibble: 104,663 x 19
          ## geonameid name asciiname alternatenames latitude longitude
          ## <int> <chr> <chr> <chr> <dbl> <dbl>
          ## 1 5881640 101 Mile Lake 101 Mile Lake "" 51.7 -121.
          ## 2 5881642 103 Mile Lake 103 Mile Lake "" 51.7 -121.
          ## 3 5881644 105 Mile Lake 105 Mile Lake "" 51.7 -121.
          ## 4 5881647 108 Mile Lake 108 Mile Lake "" 51.7 -121.
          ## 5 5881660 130 Mile Lake 130 Mile Lake "" 51.9 -122.
          ## 6 5881666 16 1/2 Mile … 16 1/2 Mile … "" 52.7 -118.
          ## 7 5881668 180 Lake 180 Lake "" 57.4 -130.
          ## 8 5881673 {1}útsaw Lake {1}utsaw Lake "" 62.7 -137.
          ## 9 5881680 24 Mile Lake 24 Mile Lake "" 46.5 -82.0
          ## 10 5881683 28 Mile Lake 28 Mile Lake "" 54.8 -124.
          ## # ... with 104,653 more rows, and 13 more variables: feature_class <chr>,
          ## # feature_code <chr>, country <chr>, cc2 <chr>, admin1_code1 <int>,
          ## # admin2_code <chr>, admin3_code <int>, admin4_code <chr>,
          ## # population <int>, elevation <int>, dem <int>, timezone <chr>,
          ## # modification_date <chr>





          share|improve this answer













          Why not just work with the CA database locally?



          library(httr)
          library(tidyverse)

          # Get CA database
          httr::GET(
          url = "http://download.geonames.org/export/dump/CA.zip",
          httr::write_disk("CA.zip"),
          httr::progress()
          ) -> res

          # unzip it
          unzip("CA.zip")

          read.csv( # readr::read_tsv doesn't like this file at least when I read it
          file = "CA.txt",
          header = FALSE,
          sep = "t",
          col.names = c(
          "geonameid", "name", "asciiname", "alternatenames", "latitude",
          "longitude", "feature_class", "feature_code", "country", "cc2",
          "admin1_code1", "admin2_code", "admin3_code", "admin4_code",
          "population", "elevation", "dem", "timezone", "modification_date"
          ),
          stringsAsFactors = FALSE
          ) %>% tbl_df() -> ca_geo

          filter(ca_geo, feature_code == "LK")
          ## # A tibble: 104,663 x 19
          ## geonameid name asciiname alternatenames latitude longitude
          ## <int> <chr> <chr> <chr> <dbl> <dbl>
          ## 1 5881640 101 Mile Lake 101 Mile Lake "" 51.7 -121.
          ## 2 5881642 103 Mile Lake 103 Mile Lake "" 51.7 -121.
          ## 3 5881644 105 Mile Lake 105 Mile Lake "" 51.7 -121.
          ## 4 5881647 108 Mile Lake 108 Mile Lake "" 51.7 -121.
          ## 5 5881660 130 Mile Lake 130 Mile Lake "" 51.9 -122.
          ## 6 5881666 16 1/2 Mile … 16 1/2 Mile … "" 52.7 -118.
          ## 7 5881668 180 Lake 180 Lake "" 57.4 -130.
          ## 8 5881673 {1}útsaw Lake {1}utsaw Lake "" 62.7 -137.
          ## 9 5881680 24 Mile Lake 24 Mile Lake "" 46.5 -82.0
          ## 10 5881683 28 Mile Lake 28 Mile Lake "" 54.8 -124.
          ## # ... with 104,653 more rows, and 13 more variables: feature_class <chr>,
          ## # feature_code <chr>, country <chr>, cc2 <chr>, admin1_code1 <int>,
          ## # admin2_code <chr>, admin3_code <int>, admin4_code <chr>,
          ## # population <int>, elevation <int>, dem <int>, timezone <chr>,
          ## # modification_date <chr>






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 21 '18 at 13:12









          hrbrmstrhrbrmstr

          61.5k691152




          61.5k691152













          • Thank you very much. This is a better solution than what I planned.

            – roshualine
            Nov 21 '18 at 13:59











          • 👍🏼 download.geonames.org/export/dump has all the databases and metadata about them.

            – hrbrmstr
            Nov 21 '18 at 14:06



















          • Thank you very much. This is a better solution than what I planned.

            – roshualine
            Nov 21 '18 at 13:59











          • 👍🏼 download.geonames.org/export/dump has all the databases and metadata about them.

            – hrbrmstr
            Nov 21 '18 at 14:06

















          Thank you very much. This is a better solution than what I planned.

          – roshualine
          Nov 21 '18 at 13:59





          Thank you very much. This is a better solution than what I planned.

          – roshualine
          Nov 21 '18 at 13:59













          👍🏼 download.geonames.org/export/dump has all the databases and metadata about them.

          – hrbrmstr
          Nov 21 '18 at 14:06





          👍🏼 download.geonames.org/export/dump has all the databases and metadata about them.

          – hrbrmstr
          Nov 21 '18 at 14:06




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53412488%2fdownloading-geonames%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          Academy of Television Arts & Sciences

          L'Équipe

          1995 France bombings