NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

Hi, how can i add world borders into my sql database? i found it in mapnik-style but here is 5 files and i can't get coordinates from this files.

asked 27 May '13, 07:14

stevocz's gravatar image

stevocz
16347
accept rate: 0%


If you want to load shape files into a PostGIS database, check out shp2pgsql. However our Mapnik styles are usually built for reading the world boundary data directly from these shape files; there should be no need to import them into PostGIS.

permanent link

answered 27 May '13, 09:03

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

i am now imported boundaries with shp2pgsql.

this is one item. how can i from this get coordinate?

gid | cat | fips_cntry | cntry_name | the_geom / 1 | 15 | AY | Antarctica | 010600000001000000010300000001000000260000003BC .. (snipped)

(05 Jun '13, 07:12) stevocz
1

Use the st_astext function in your query, like "select cntry_name,st_astext(the_geom) from tablename..."

(06 Jun '13, 10:03) Frederik Ramm ♦

thank you.

your sql select work very well, but border is little moved. see picture: http://s18.postimg.org/6s75eqjy1/border.png

on northern hemisphere is latitude moved lower about 0.2 and on southern hemisphere is latitude moved higher about 0.2

(06 Jun '13, 14:25) stevocz

i use this function for convert coordinate

double AQConverter::MercatorToLon(double x){

double rMajor = 6378137; //Equatorial Radius, WGS84

double shift  = M_PI * rMajor;

double lon    = x / shift * 180.0;

return lon;

}

double AQConverter::MercatorToLat(double y){

double rMajor = 6378137; //Equatorial Radius, WGS84

double shift  = M_PI * rMajor;

double lat    = y / shift * 180.0;

lat = 180.0/ M_PI * (2 * qAtan(qExp((lat * M_PI) / 180.0)) - M_PI / 2.0);

return lat;

}

(06 Jun '13, 14:30) stevocz

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×32
×18
×15
×10

question asked: 27 May '13, 07:14

question was seen: 16,444 times

last updated: 06 Jun '13, 14:45

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum