[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Storing coordinated in Postgresql

Posted on 2015-01-23
12
Medium Priority
?
193 Views
Last Modified: 2015-01-29
Hi
I have got a dataset that includes Long/latitude and Easting/Northing; a few of the records look like this:
51.750365      -0.34032      514667      207044
51.563842      0.207556      553111      187305
51.69484      -0.386208      511636      200798
51.393646      -0.171873      527286      167653
51.42931      -0.500216      504362      171101
51.413846      -0.422078      509831      169495
51.660042      -0.405021      510420      196899
51.680993      0.009067      538996      199936

I have read that I should store these values as "points" in Postgresql but when I try to import from my excel spreadsheet where they are stored as "general", I get an error. I have also tried to store as a number and that didn't work either.

What is the best way to do this?
thanks
0
Comment
Question by:lz7cjc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
12 Comments
 
LVL 40

Expert Comment

by:als315
ID: 40568011
0
 
LVL 62

Accepted Solution

by:
gheist earned 1000 total points
ID: 40568611
PostGIS has all the geo data types builtin. Sure you can define your type, though why not take what somebody did for you...
0
 

Author Comment

by:lz7cjc
ID: 40570128
thanks - I agree but I can't work out how to use PostGIS! I have installed it but I can't find it (
0
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 
LVL 62

Expert Comment

by:gheist
ID: 40570405
0
 

Author Comment

by:lz7cjc
ID: 40570418
ok but if I am using the visual editor, pgadmin, where do I find that option in the table builder ->add column?
0
 
LVL 62

Expert Comment

by:gheist
ID: 40570422
It has extensions to default postgresql installation, like dll/so files.
you can also configure your own type of two floats, or plainly use 2 floats to record coordinates.
0
 

Author Comment

by:lz7cjc
ID: 40570460
Thanks for your help on this but I'm far from clear on what I'm meant to do. Please can you explain the steps, assuming I'm an idiot?
Thanks
0
 
LVL 62

Expert Comment

by:gheist
ID: 40570535
Either
1) add extensions of postgis to postgresql server (that lets you query distances form SQL)
2) define your own type of pair of floats
3) just add 2 float columns to store coordinates
0
 

Author Comment

by:lz7cjc
ID: 40570602
ok thanks - I am going to be feeding these coords into geomapping so it sounds like the float type will work. Will try that and let you know
0
 

Author Comment

by:lz7cjc
ID: 40570617
ummm - float doesn't exist as a data type in the drop down list in pgadmin

however Latitude and longitude are appearing as data types - so that would be the answer then!
0
 
LVL 62

Expert Comment

by:gheist
ID: 40570718
It is real or double precision.
real is accurate to 6 digits
double otherwise (like your example)
0
 

Author Closing Comment

by:lz7cjc
ID: 40578251
The types longitude and latitude appear automatically in the drop down list if postgis is installed
0

Featured Post

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question