Importing geospatial data into Redis









up vote
0
down vote

favorite












I have several shapefiles that I would like to import into several databases in order to measure the performance of queries, one of them is Redis. I tried to convert shapefile to CSV format, but I'm stuck on it.
Here is an example of a fragment of such a CSV file (builtups.csv):



student@student:~/Downloads/json/csv$ head -2 < builtups.csv 
WKT,cat,NAME,F_CODE
"POLYGON ((-1381208.93176959 4018867.04896281,-1381545.4605916 4020028.58540091,-1379543.95554302 4021140.67154976,-1379854.59452705 4021569.00939107,-1380453.82420181 4021984.78053386,-1380620.70731434 4022565.37636904,-1377122.99898975 4022708.4072678,-1376019.8736383 4020549.48804913,-1381208.93176959 4018867.04896281))",1,BETHEL,Built-Up Area


Another example:



 student@student:~/Downloads/json/csv$ head < popp.csv 
WKT,cat,F_CODEDESC,F_CODE,TYPE
"POINT (-1049809.14913148 6635460.69190277)",1.000,Building,AL015,CABIN
"POINT (441308.810636207 6573953.19546494)",2.000,Building,AL015,CABINS
"POINT (340199.412944192 6540038.90039579)",3.000,Building,AL015,CABIN
"POINT (191579.478604275 6529955.3502767)",4.000,Building,AL015,CABIN


Does Redis geo have the capability for storing polygons? If yes, how to import those CSV files to Redis? If not, how do I avoid the problem?










share|improve this question









New contributor




Dominik Bartoszewski is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.























    up vote
    0
    down vote

    favorite












    I have several shapefiles that I would like to import into several databases in order to measure the performance of queries, one of them is Redis. I tried to convert shapefile to CSV format, but I'm stuck on it.
    Here is an example of a fragment of such a CSV file (builtups.csv):



    student@student:~/Downloads/json/csv$ head -2 < builtups.csv 
    WKT,cat,NAME,F_CODE
    "POLYGON ((-1381208.93176959 4018867.04896281,-1381545.4605916 4020028.58540091,-1379543.95554302 4021140.67154976,-1379854.59452705 4021569.00939107,-1380453.82420181 4021984.78053386,-1380620.70731434 4022565.37636904,-1377122.99898975 4022708.4072678,-1376019.8736383 4020549.48804913,-1381208.93176959 4018867.04896281))",1,BETHEL,Built-Up Area


    Another example:



     student@student:~/Downloads/json/csv$ head < popp.csv 
    WKT,cat,F_CODEDESC,F_CODE,TYPE
    "POINT (-1049809.14913148 6635460.69190277)",1.000,Building,AL015,CABIN
    "POINT (441308.810636207 6573953.19546494)",2.000,Building,AL015,CABINS
    "POINT (340199.412944192 6540038.90039579)",3.000,Building,AL015,CABIN
    "POINT (191579.478604275 6529955.3502767)",4.000,Building,AL015,CABIN


    Does Redis geo have the capability for storing polygons? If yes, how to import those CSV files to Redis? If not, how do I avoid the problem?










    share|improve this question









    New contributor




    Dominik Bartoszewski is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.





















      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I have several shapefiles that I would like to import into several databases in order to measure the performance of queries, one of them is Redis. I tried to convert shapefile to CSV format, but I'm stuck on it.
      Here is an example of a fragment of such a CSV file (builtups.csv):



      student@student:~/Downloads/json/csv$ head -2 < builtups.csv 
      WKT,cat,NAME,F_CODE
      "POLYGON ((-1381208.93176959 4018867.04896281,-1381545.4605916 4020028.58540091,-1379543.95554302 4021140.67154976,-1379854.59452705 4021569.00939107,-1380453.82420181 4021984.78053386,-1380620.70731434 4022565.37636904,-1377122.99898975 4022708.4072678,-1376019.8736383 4020549.48804913,-1381208.93176959 4018867.04896281))",1,BETHEL,Built-Up Area


      Another example:



       student@student:~/Downloads/json/csv$ head < popp.csv 
      WKT,cat,F_CODEDESC,F_CODE,TYPE
      "POINT (-1049809.14913148 6635460.69190277)",1.000,Building,AL015,CABIN
      "POINT (441308.810636207 6573953.19546494)",2.000,Building,AL015,CABINS
      "POINT (340199.412944192 6540038.90039579)",3.000,Building,AL015,CABIN
      "POINT (191579.478604275 6529955.3502767)",4.000,Building,AL015,CABIN


      Does Redis geo have the capability for storing polygons? If yes, how to import those CSV files to Redis? If not, how do I avoid the problem?










      share|improve this question









      New contributor




      Dominik Bartoszewski is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      I have several shapefiles that I would like to import into several databases in order to measure the performance of queries, one of them is Redis. I tried to convert shapefile to CSV format, but I'm stuck on it.
      Here is an example of a fragment of such a CSV file (builtups.csv):



      student@student:~/Downloads/json/csv$ head -2 < builtups.csv 
      WKT,cat,NAME,F_CODE
      "POLYGON ((-1381208.93176959 4018867.04896281,-1381545.4605916 4020028.58540091,-1379543.95554302 4021140.67154976,-1379854.59452705 4021569.00939107,-1380453.82420181 4021984.78053386,-1380620.70731434 4022565.37636904,-1377122.99898975 4022708.4072678,-1376019.8736383 4020549.48804913,-1381208.93176959 4018867.04896281))",1,BETHEL,Built-Up Area


      Another example:



       student@student:~/Downloads/json/csv$ head < popp.csv 
      WKT,cat,F_CODEDESC,F_CODE,TYPE
      "POINT (-1049809.14913148 6635460.69190277)",1.000,Building,AL015,CABIN
      "POINT (441308.810636207 6573953.19546494)",2.000,Building,AL015,CABINS
      "POINT (340199.412944192 6540038.90039579)",3.000,Building,AL015,CABIN
      "POINT (191579.478604275 6529955.3502767)",4.000,Building,AL015,CABIN


      Does Redis geo have the capability for storing polygons? If yes, how to import those CSV files to Redis? If not, how do I avoid the problem?







      database csv redis geospatial shapefile






      share|improve this question









      New contributor




      Dominik Bartoszewski is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      Dominik Bartoszewski is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited Nov 10 at 14:52









      Mihai Chelaru

      1,8297816




      1,8297816






      New contributor




      Dominik Bartoszewski is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked Nov 10 at 13:37









      Dominik Bartoszewski

      11




      11




      New contributor




      Dominik Bartoszewski is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Dominik Bartoszewski is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Dominik Bartoszewski is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          GEOADD, GEODIST, GEOHASH, GEOPOS, GEORADIUS and GEORADIUSBYMEMBER are the only Redis geo-related commands that I'm aware of, and none of them applies to polygons (except for the particular case of bounding boxes, and they are not stored anyway).



          That said, nothing prevents you from storing WKT polygons as text strings, or, alternatively, convert the original shapefile polygons to GeoJson and store them as regular JSON objects via Rejson, a Json datatype for Redis,



          https://github.com/redislabsmodules/rejson






          share|improve this answer




















          • If I convert to the Rejson format, is it possible to check if the point is included in the polygon? Something like ST_Contains or ST_Within in PostGIS?
            – Dominik Bartoszewski
            8 hours ago










          • github.com/RedisLabs/geo.lua/blob/master/…
            – lusitanica
            4 hours ago










          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',
          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
          );



          );






          Dominik Bartoszewski is a new contributor. Be nice, and check out our Code of Conduct.









           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53239523%2fimporting-geospatial-data-into-redis%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote













          GEOADD, GEODIST, GEOHASH, GEOPOS, GEORADIUS and GEORADIUSBYMEMBER are the only Redis geo-related commands that I'm aware of, and none of them applies to polygons (except for the particular case of bounding boxes, and they are not stored anyway).



          That said, nothing prevents you from storing WKT polygons as text strings, or, alternatively, convert the original shapefile polygons to GeoJson and store them as regular JSON objects via Rejson, a Json datatype for Redis,



          https://github.com/redislabsmodules/rejson






          share|improve this answer




















          • If I convert to the Rejson format, is it possible to check if the point is included in the polygon? Something like ST_Contains or ST_Within in PostGIS?
            – Dominik Bartoszewski
            8 hours ago










          • github.com/RedisLabs/geo.lua/blob/master/…
            – lusitanica
            4 hours ago














          up vote
          0
          down vote













          GEOADD, GEODIST, GEOHASH, GEOPOS, GEORADIUS and GEORADIUSBYMEMBER are the only Redis geo-related commands that I'm aware of, and none of them applies to polygons (except for the particular case of bounding boxes, and they are not stored anyway).



          That said, nothing prevents you from storing WKT polygons as text strings, or, alternatively, convert the original shapefile polygons to GeoJson and store them as regular JSON objects via Rejson, a Json datatype for Redis,



          https://github.com/redislabsmodules/rejson






          share|improve this answer




















          • If I convert to the Rejson format, is it possible to check if the point is included in the polygon? Something like ST_Contains or ST_Within in PostGIS?
            – Dominik Bartoszewski
            8 hours ago










          • github.com/RedisLabs/geo.lua/blob/master/…
            – lusitanica
            4 hours ago












          up vote
          0
          down vote










          up vote
          0
          down vote









          GEOADD, GEODIST, GEOHASH, GEOPOS, GEORADIUS and GEORADIUSBYMEMBER are the only Redis geo-related commands that I'm aware of, and none of them applies to polygons (except for the particular case of bounding boxes, and they are not stored anyway).



          That said, nothing prevents you from storing WKT polygons as text strings, or, alternatively, convert the original shapefile polygons to GeoJson and store them as regular JSON objects via Rejson, a Json datatype for Redis,



          https://github.com/redislabsmodules/rejson






          share|improve this answer












          GEOADD, GEODIST, GEOHASH, GEOPOS, GEORADIUS and GEORADIUSBYMEMBER are the only Redis geo-related commands that I'm aware of, and none of them applies to polygons (except for the particular case of bounding boxes, and they are not stored anyway).



          That said, nothing prevents you from storing WKT polygons as text strings, or, alternatively, convert the original shapefile polygons to GeoJson and store them as regular JSON objects via Rejson, a Json datatype for Redis,



          https://github.com/redislabsmodules/rejson







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 2 days ago









          lusitanica

          1667




          1667











          • If I convert to the Rejson format, is it possible to check if the point is included in the polygon? Something like ST_Contains or ST_Within in PostGIS?
            – Dominik Bartoszewski
            8 hours ago










          • github.com/RedisLabs/geo.lua/blob/master/…
            – lusitanica
            4 hours ago
















          • If I convert to the Rejson format, is it possible to check if the point is included in the polygon? Something like ST_Contains or ST_Within in PostGIS?
            – Dominik Bartoszewski
            8 hours ago










          • github.com/RedisLabs/geo.lua/blob/master/…
            – lusitanica
            4 hours ago















          If I convert to the Rejson format, is it possible to check if the point is included in the polygon? Something like ST_Contains or ST_Within in PostGIS?
          – Dominik Bartoszewski
          8 hours ago




          If I convert to the Rejson format, is it possible to check if the point is included in the polygon? Something like ST_Contains or ST_Within in PostGIS?
          – Dominik Bartoszewski
          8 hours ago












          github.com/RedisLabs/geo.lua/blob/master/…
          – lusitanica
          4 hours ago




          github.com/RedisLabs/geo.lua/blob/master/…
          – lusitanica
          4 hours ago










          Dominik Bartoszewski is a new contributor. Be nice, and check out our Code of Conduct.









           

          draft saved


          draft discarded


















          Dominik Bartoszewski is a new contributor. Be nice, and check out our Code of Conduct.












          Dominik Bartoszewski is a new contributor. Be nice, and check out our Code of Conduct.











          Dominik Bartoszewski is a new contributor. Be nice, and check out our Code of Conduct.













           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53239523%2fimporting-geospatial-data-into-redis%23new-answer', 'question_page');

          );

          Post as a guest














































































          Popular posts from this blog

          Top Tejano songwriter Luis Silva dead of heart attack at 64

          政党

          天津地下鉄3号線