newbie postgis and google maps question

View: New views
6 Messages — Rating Filter:   Alert me  

newbie postgis and google maps question

by Sam Boggess :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I'm new to PostGIS and this has to be a cakewalk for
you experienced users, but your help would be greatly appreciated.  I
have a PostGIS enabled database that contains polygon data from a
shapefile using SRID 4326.  All I want to do at this point is mark the
centers of all of my polygons in Google Maps.  I've written my
query, and it works great:

select astext(centroid(poly))
from zones

returns (a bunch of):
POINT(-13057223.7425678 6208110.75868711)

However, I have no idea what to do with this point data.  Google maps expects lat and long; how can i convert this?  In another forum a user suggested dividing by 10, but that's a point in Northern Canada, this point should be in NE Washington State.

Any Help would be greatly appreciated

Re: newbie postgis and google maps question

by Paul Ramsey :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Your original data is probably not 4326. Do you have any clue what  
projection it is in? Where did you get it from?

P

On Jan 20, 2008, at 7:02 PM, Sam Boggess wrote:

>
> Hello,
>
> I'm new to PostGIS and this has to be a cakewalk for
> you experienced users, but your help would be greatly appreciated.  I
> have a PostGIS enabled database that contains polygon data from a
> shapefile using SRID 4326.  All I want to do at this point is mark the
> centers of all of my polygons in Google Maps.  I've written my
> query, and it works great:
>
> select astext(centroid(poly))
> from zones
>
> returns (a bunch of):
> POINT(-13057223.7425678 6208110.75868711)
>
> However, I have no idea what to do with this point data.  Google maps
> expects lat and long; how can i convert this?  In another forum a user
> suggested dividing by 10, but that's a point in Northern Canada,  
> this point
> should be in NE Washington State.
>
> Any Help would be greatly appreciated
> --
> View this message in context: http://www.nabble.com/newbie-postgis-and-google-maps-question-tp14989995p14989995.html
> Sent from the PostGIS - User mailing list archive at Nabble.com.
>
> _______________________________________________
> postgis-users mailing list
> postgis-users@...
> http://postgis.refractions.net/mailman/listinfo/postgis-users

_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

Re: newbie postgis and google maps question

by Sam Boggess :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The original shape file, that I got from the Oregon Forestry Department, had this projection:

Data Type: Shapefile Feature Class
Shapefile: Z:\FSN\seedzone_pre1996\sz_orwa_pre1996.shp
Geometry Type: Polygon

Projected Coordinate System: NAD_1983_Oregon_Statewide_Lambert_Feet_Intl
Projection: Lambert_Conformal_Conic
False_Easting: 1312335.95800525
False_Northing: 0.00000000
Central_Meridian: -120.50000000
Standard_Parallel_1: 43.00000000
Standard_Parallel_2: 45.50000000
Latitude_Of_Origin: 41.75000000
Linear Unit: Foot

Geographic Coordinate System: GCS_North_American_1983
Datum: D_North_American_1983
Prime Meridian: 0
Angular Unit: Degree


So I projected that into mercator in ArcMap:

Data Type: Shapefile Feature Class
Shapefile: Z:\FSN\seedzone_pre1996\sz_orwa_pre1996_Project.shp
Geometry Type: Polygon

Projected Coordinate System: World_Mercator
Projection: Mercator
False_Easting: 0.00000000
False_Northing: 0.00000000
Central_Meridian: 0.00000000
Standard_Parallel_1: 0.00000000
Linear Unit: Meter

Geographic Coordinate System: GCS_WGS_1984
Datum: D_WGS_1984
Prime Meridian: 0
Angular Unit: Degree


I then used shp2pgsql to add this to my database:

SELECT AddGeometryColumn('members_oldzone', 'poly', 4326, 'MULTIPOLYGON', 2);
ALTER TABLE "members_oldzone" ALTER "poly" SET NOT NULL;
CREATE INDEX "members_oldzone_poly_id" ON "members_oldzone" USING GIST ( "poly" GIST_GEOMETRY_OPS );


Paul Ramsey wrote:
Your original data is probably not 4326. Do you have any clue what  
projection it is in? Where did you get it from?

P

On Jan 20, 2008, at 7:02 PM, Sam Boggess wrote:

>
> Hello,
>
> I'm new to PostGIS and this has to be a cakewalk for
> you experienced users, but your help would be greatly appreciated.  I
> have a PostGIS enabled database that contains polygon data from a
> shapefile using SRID 4326.  All I want to do at this point is mark the
> centers of all of my polygons in Google Maps.  I've written my
> query, and it works great:
>
> select astext(centroid(poly))
> from zones
>
> returns (a bunch of):
> POINT(-13057223.7425678 6208110.75868711)
>
> However, I have no idea what to do with this point data.  Google maps
> expects lat and long; how can i convert this?  In another forum a user
> suggested dividing by 10, but that's a point in Northern Canada,  
> this point
> should be in NE Washington State.
>
> Any Help would be greatly appreciated
> --
> View this message in context: http://www.nabble.com/newbie-postgis-and-google-maps-question-tp14989995p14989995.html
> Sent from the PostGIS - User mailing list archive at Nabble.com.
>
> _______________________________________________
> postgis-users mailing list
> postgis-users@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users

_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users

Re: newbie postgis and google maps question

by Paul Ramsey :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Mercator <> EPSG:4326

4326 is geographic coordinates on a WGS84 spheroid.  Mercator is  
projected coordinates still.

Either upload your shape file in the original coordinates, and then  
transform in PostGIS:

shp2pgsql -D -i -s 2992 shpfile.shp tablename
select ST_AsText(ST_Transform(the_geom, 4326)) from tablename

Or do you ArcMap stuff but output in 4326 to start with.

Good luck!

P.

On Jan 20, 2008, at 7:39 PM, Sam Boggess wrote:

>
> The original shape file, that I got from the Oregon Forestry  
> Department, had
> this projection:
>
> Data Type: Shapefile Feature Class
> Shapefile: Z:\FSN\seedzone_pre1996\sz_orwa_pre1996.shp
> Geometry Type: Polygon
>
> Projected Coordinate System:  
> NAD_1983_Oregon_Statewide_Lambert_Feet_Intl
> Projection: Lambert_Conformal_Conic
> False_Easting: 1312335.95800525
> False_Northing: 0.00000000
> Central_Meridian: -120.50000000
> Standard_Parallel_1: 43.00000000
> Standard_Parallel_2: 45.50000000
> Latitude_Of_Origin: 41.75000000
> Linear Unit: Foot
>
> Geographic Coordinate System: GCS_North_American_1983
> Datum: D_North_American_1983
> Prime Meridian: 0
> Angular Unit: Degree
>
>
> So I projected that into mercator in ArcMap:
>
> Data Type: Shapefile Feature Class
> Shapefile: Z:\FSN\seedzone_pre1996\sz_orwa_pre1996_Project.shp
> Geometry Type: Polygon
>
> Projected Coordinate System: World_Mercator
> Projection: Mercator
> False_Easting: 0.00000000
> False_Northing: 0.00000000
> Central_Meridian: 0.00000000
> Standard_Parallel_1: 0.00000000
> Linear Unit: Meter
>
> Geographic Coordinate System: GCS_WGS_1984
> Datum: D_WGS_1984
> Prime Meridian: 0
> Angular Unit: Degree
>
>
> I then used shp2pgsql to add this to my database:
>
> SELECT AddGeometryColumn('members_oldzone', 'poly', 4326,  
> 'MULTIPOLYGON',
> 2);
> ALTER TABLE "members_oldzone" ALTER "poly" SET NOT NULL;
> CREATE INDEX "members_oldzone_poly_id" ON "members_oldzone" USING  
> GIST (
> "poly" GIST_GEOMETRY_OPS );
>
>
>
> Paul Ramsey wrote:
>>
>> Your original data is probably not 4326. Do you have any clue what
>> projection it is in? Where did you get it from?
>>
>> P
>>
>> On Jan 20, 2008, at 7:02 PM, Sam Boggess wrote:
>>
>>>
>>> Hello,
>>>
>>> I'm new to PostGIS and this has to be a cakewalk for
>>> you experienced users, but your help would be greatly  
>>> appreciated.  I
>>> have a PostGIS enabled database that contains polygon data from a
>>> shapefile using SRID 4326.  All I want to do at this point is mark  
>>> the
>>> centers of all of my polygons in Google Maps.  I've written my
>>> query, and it works great:
>>>
>>> select astext(centroid(poly))
>>> from zones
>>>
>>> returns (a bunch of):
>>> POINT(-13057223.7425678 6208110.75868711)
>>>
>>> However, I have no idea what to do with this point data.  Google  
>>> maps
>>> expects lat and long; how can i convert this?  In another forum a  
>>> user
>>> suggested dividing by 10, but that's a point in Northern Canada,
>>> this point
>>> should be in NE Washington State.
>>>
>>> Any Help would be greatly appreciated
>>> --
>>> View this message in context:
>>> http://www.nabble.com/newbie-postgis-and-google-maps-question-tp14989995p14989995.html
>>> Sent from the PostGIS - User mailing list archive at Nabble.com.
>>>
>>> _______________________________________________
>>> postgis-users mailing list
>>> postgis-users@...
>>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users@...
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
>>
>
> --
> View this message in context: http://www.nabble.com/newbie-postgis-and-google-maps-question-tp14989995p14990735.html
> Sent from the PostGIS - User mailing list archive at Nabble.com.
>
> _______________________________________________
> postgis-users mailing list
> postgis-users@...
> http://postgis.refractions.net/mailman/listinfo/postgis-users

_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

Re: newbie postgis and google maps question

by Sam Boggess :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thank you so much!  I'll try transforming it at the shp2pgsql stage.

In ArcMap does 4326 have a name?  I can't find it?


Paul Ramsey wrote:
Mercator <> EPSG:4326

4326 is geographic coordinates on a WGS84 spheroid.  Mercator is  
projected coordinates still.

Either upload your shape file in the original coordinates, and then  
transform in PostGIS:

shp2pgsql -D -i -s 2992 shpfile.shp tablename
select ST_AsText(ST_Transform(the_geom, 4326)) from tablename

Or do you ArcMap stuff but output in 4326 to start with.

Good luck!

P.

On Jan 20, 2008, at 7:39 PM, Sam Boggess wrote:

>
> The original shape file, that I got from the Oregon Forestry  
> Department, had
> this projection:
>
> Data Type: Shapefile Feature Class
> Shapefile: Z:\FSN\seedzone_pre1996\sz_orwa_pre1996.shp
> Geometry Type: Polygon
>
> Projected Coordinate System:  
> NAD_1983_Oregon_Statewide_Lambert_Feet_Intl
> Projection: Lambert_Conformal_Conic
> False_Easting: 1312335.95800525
> False_Northing: 0.00000000
> Central_Meridian: -120.50000000
> Standard_Parallel_1: 43.00000000
> Standard_Parallel_2: 45.50000000
> Latitude_Of_Origin: 41.75000000
> Linear Unit: Foot
>
> Geographic Coordinate System: GCS_North_American_1983
> Datum: D_North_American_1983
> Prime Meridian: 0
> Angular Unit: Degree
>
>
> So I projected that into mercator in ArcMap:
>
> Data Type: Shapefile Feature Class
> Shapefile: Z:\FSN\seedzone_pre1996\sz_orwa_pre1996_Project.shp
> Geometry Type: Polygon
>
> Projected Coordinate System: World_Mercator
> Projection: Mercator
> False_Easting: 0.00000000
> False_Northing: 0.00000000
> Central_Meridian: 0.00000000
> Standard_Parallel_1: 0.00000000
> Linear Unit: Meter
>
> Geographic Coordinate System: GCS_WGS_1984
> Datum: D_WGS_1984
> Prime Meridian: 0
> Angular Unit: Degree
>
>
> I then used shp2pgsql to add this to my database:
>
> SELECT AddGeometryColumn('members_oldzone', 'poly', 4326,  
> 'MULTIPOLYGON',
> 2);
> ALTER TABLE "members_oldzone" ALTER "poly" SET NOT NULL;
> CREATE INDEX "members_oldzone_poly_id" ON "members_oldzone" USING  
> GIST (
> "poly" GIST_GEOMETRY_OPS );
>
>
>
> Paul Ramsey wrote:
>>
>> Your original data is probably not 4326. Do you have any clue what
>> projection it is in? Where did you get it from?
>>
>> P
>>
>> On Jan 20, 2008, at 7:02 PM, Sam Boggess wrote:
>>
>>>
>>> Hello,
>>>
>>> I'm new to PostGIS and this has to be a cakewalk for
>>> you experienced users, but your help would be greatly  
>>> appreciated.  I
>>> have a PostGIS enabled database that contains polygon data from a
>>> shapefile using SRID 4326.  All I want to do at this point is mark  
>>> the
>>> centers of all of my polygons in Google Maps.  I've written my
>>> query, and it works great:
>>>
>>> select astext(centroid(poly))
>>> from zones
>>>
>>> returns (a bunch of):
>>> POINT(-13057223.7425678 6208110.75868711)
>>>
>>> However, I have no idea what to do with this point data.  Google  
>>> maps
>>> expects lat and long; how can i convert this?  In another forum a  
>>> user
>>> suggested dividing by 10, but that's a point in Northern Canada,
>>> this point
>>> should be in NE Washington State.
>>>
>>> Any Help would be greatly appreciated
>>> --
>>> View this message in context:
>>> http://www.nabble.com/newbie-postgis-and-google-maps-question-tp14989995p14989995.html
>>> Sent from the PostGIS - User mailing list archive at Nabble.com.
>>>
>>> _______________________________________________
>>> postgis-users mailing list
>>> postgis-users@postgis.refractions.net
>>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users@postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
>>
>
> --
> View this message in context: http://www.nabble.com/newbie-postgis-and-google-maps-question-tp14989995p14990735.html
> Sent from the PostGIS - User mailing list archive at Nabble.com.
>
> _______________________________________________
> postgis-users mailing list
> postgis-users@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users

_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users

Re: newbie postgis and google maps question

by Paul Ramsey :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

"Geographic Coordinates", "Longitude / Latitude", "Unprojected" ?

P.

On Jan 20, 2008, at 8:07 PM, Sam Boggess wrote:

>
> Thank you so much!  I'll try transforming it at the shp2pgsql stage.
>
> In ArcMap does 4326 have a name?  I can't find it?
>
>
>
> Paul Ramsey wrote:
>>
>> Mercator <> EPSG:4326
>>
>> 4326 is geographic coordinates on a WGS84 spheroid.  Mercator is
>> projected coordinates still.
>>
>> Either upload your shape file in the original coordinates, and then
>> transform in PostGIS:
>>
>> shp2pgsql -D -i -s 2992 shpfile.shp tablename
>> select ST_AsText(ST_Transform(the_geom, 4326)) from tablename
>>
>> Or do you ArcMap stuff but output in 4326 to start with.
>>
>> Good luck!
>>
>> P.
>>
>> On Jan 20, 2008, at 7:39 PM, Sam Boggess wrote:
>>
>>>
>>> The original shape file, that I got from the Oregon Forestry
>>> Department, had
>>> this projection:
>>>
>>> Data Type: Shapefile Feature Class
>>> Shapefile: Z:\FSN\seedzone_pre1996\sz_orwa_pre1996.shp
>>> Geometry Type: Polygon
>>>
>>> Projected Coordinate System:
>>> NAD_1983_Oregon_Statewide_Lambert_Feet_Intl
>>> Projection: Lambert_Conformal_Conic
>>> False_Easting: 1312335.95800525
>>> False_Northing: 0.00000000
>>> Central_Meridian: -120.50000000
>>> Standard_Parallel_1: 43.00000000
>>> Standard_Parallel_2: 45.50000000
>>> Latitude_Of_Origin: 41.75000000
>>> Linear Unit: Foot
>>>
>>> Geographic Coordinate System: GCS_North_American_1983
>>> Datum: D_North_American_1983
>>> Prime Meridian: 0
>>> Angular Unit: Degree
>>>
>>>
>>> So I projected that into mercator in ArcMap:
>>>
>>> Data Type: Shapefile Feature Class
>>> Shapefile: Z:\FSN\seedzone_pre1996\sz_orwa_pre1996_Project.shp
>>> Geometry Type: Polygon
>>>
>>> Projected Coordinate System: World_Mercator
>>> Projection: Mercator
>>> False_Easting: 0.00000000
>>> False_Northing: 0.00000000
>>> Central_Meridian: 0.00000000
>>> Standard_Parallel_1: 0.00000000
>>> Linear Unit: Meter
>>>
>>> Geographic Coordinate System: GCS_WGS_1984
>>> Datum: D_WGS_1984
>>> Prime Meridian: 0
>>> Angular Unit: Degree
>>>
>>>
>>> I then used shp2pgsql to add this to my database:
>>>
>>> SELECT AddGeometryColumn('members_oldzone', 'poly', 4326,
>>> 'MULTIPOLYGON',
>>> 2);
>>> ALTER TABLE "members_oldzone" ALTER "poly" SET NOT NULL;
>>> CREATE INDEX "members_oldzone_poly_id" ON "members_oldzone" USING
>>> GIST (
>>> "poly" GIST_GEOMETRY_OPS );
>>>
>>>
>>>
>>> Paul Ramsey wrote:
>>>>
>>>> Your original data is probably not 4326. Do you have any clue what
>>>> projection it is in? Where did you get it from?
>>>>
>>>> P
>>>>
>>>> On Jan 20, 2008, at 7:02 PM, Sam Boggess wrote:
>>>>
>>>>>
>>>>> Hello,
>>>>>
>>>>> I'm new to PostGIS and this has to be a cakewalk for
>>>>> you experienced users, but your help would be greatly
>>>>> appreciated.  I
>>>>> have a PostGIS enabled database that contains polygon data from a
>>>>> shapefile using SRID 4326.  All I want to do at this point is mark
>>>>> the
>>>>> centers of all of my polygons in Google Maps.  I've written my
>>>>> query, and it works great:
>>>>>
>>>>> select astext(centroid(poly))
>>>>> from zones
>>>>>
>>>>> returns (a bunch of):
>>>>> POINT(-13057223.7425678 6208110.75868711)
>>>>>
>>>>> However, I have no idea what to do with this point data.  Google
>>>>> maps
>>>>> expects lat and long; how can i convert this?  In another forum a
>>>>> user
>>>>> suggested dividing by 10, but that's a point in Northern Canada,
>>>>> this point
>>>>> should be in NE Washington State.
>>>>>
>>>>> Any Help would be greatly appreciated
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/newbie-postgis-and-google-maps-question-tp14989995p14989995.html
>>>>> Sent from the PostGIS - User mailing list archive at Nabble.com.
>>>>>
>>>>> _______________________________________________
>>>>> postgis-users mailing list
>>>>> postgis-users@...
>>>>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>>>
>>>> _______________________________________________
>>>> postgis-users mailing list
>>>> postgis-users@...
>>>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/newbie-postgis-and-google-maps-question-tp14989995p14990735.html
>>> Sent from the PostGIS - User mailing list archive at Nabble.com.
>>>
>>> _______________________________________________
>>> postgis-users mailing list
>>> postgis-users@...
>>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users@...
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
>>
>
> --
> View this message in context: http://www.nabble.com/newbie-postgis-and-google-maps-question-tp14989995p14990938.html
> Sent from the PostGIS - User mailing list archive at Nabble.com.
>
> _______________________________________________
> postgis-users mailing list
> postgis-users@...
> http://postgis.refractions.net/mailman/listinfo/postgis-users

_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users