Hi Gerald,
It does input my 3 polygons inside the new table with lat around 22 and
long 0.xxx. Is it normal for the long?
No, that doesnt sound right - longitude should be somewhere around 113º
32' 11'' E. Latitude sounds right for lat origin 22º 12' 44'' N. Something
apparently isnt correct on the spatial_ref_sys entry or the data is a long
way from the transverse mercator meridian. Check over the spatial_ref_sys
again. Its easy to make a mistake.
Also it sounds like from the way you are creating basemap_land that you
may not have an entry in the PostGIS geometry_columns table. If I recall
correctly GeoServer will not find the geometry column when attempting to
create a feature type unless there is a record in the geometry_columns table
You can do this manually with an insert similar to this:
INSERT INTO geometry_columns (f_table_catalog, f_table_schema, f_table_name,
f_geometry_column, coord_dimension, srid, "type") VALUES ('', 'public',
'table', 'the_geom', 2, 104309, 'LINESTRING');
Or better approach, use the PostGIS AddGeometryColumn function similar to
this:
select AddGeometryColumn('DB',table','the_geom','104309','LINESTRING',2);
syntax found here http://postgis.refractions.net/docs/ch04.html#id2523380
* AddGeometryColumn(<schema_name>, <table_name>,
* <column_name>, <srid>, <type>, <dimension>)
Randy George
_____
From: geoserver-users-bounces@lists.sourceforge.net
[mailto:geoserver-users-bounces@lists.sourceforge.net] On Behalf Of Gerald
Estadieu
Sent: Friday, July 07, 2006 12:39 PM
To: Randy George; geoserver-users@lists.sourceforge.net
Subject: Re: [Geoserver-users] newbie on projection/datum
Hi Randy,
thanks for this very details information, that's what I needed to
understand.
Here is what I have done so far:
- insert my SRS into Geoserver gt2-epsg.jar and it appears on the list in
the web admin. When I connect to postgis and input it, it shows me long/lat
around 113 and 22 which are corresponding to the positionning of Macao.
- insert the SRS into my database in spatial_ref_sys (btw I could not find
in the list the one you mention 104106 from ESRI, is it normal?).
Until now, my geom column was in SRID=-1, so I change it to the new one
104309 (sometimes does not work due to some 'violation' by some row, I have
to investigate on this probably).
I tried to create a similar table with srid 4326 and do an:
insert into basemap_land select
gid,entity,layer,"level",elevation,color,Transform(the_geom,4326) from
land_2005;
It does input my 3 polygons inside the new table with lat around 22 and long
0.xxx. Is it normal for the long?
Moreover when I try to make it as a feature type in geoserver, it cannot
detect the srs and if I put 4326 it keeps telling me
'The FeatureType 'basemap_land' has a NULL extent.
HINT: the dataset is empty or has no default geometry attribute.'
The dataset is not empty and there is one geometry column. Is it because the
CRS is not correct and so the transform is not working well?
here is the SQL I use to create my new table (based on the existing one):
CREATE TABLE basemap_land
(
gid serial NOT NULL,
entity varchar(14),
layer varchar(32),
"level" int8,
elevation float8,
color int4,
the_geom geometry,
CONSTRAINT basemap_land_pkey PRIMARY KEY (gid),
CONSTRAINT enforce_dims_the_geom CHECK (ndims(the_geom) = 2),
CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) =
'MULTIPOLYGON'::text OR the_geom IS NULL),
CONSTRAINT enforce_srid_the_geom CHECK (srid(the_geom) = 4326)
)
WITH OIDS;
ALTER TABLE basemap_land OWNER TO postgres;
For information I use geoserver 1.3.2 (btw, I read there is a sld wizard but
no where there is a link to access it...unless I am nuts).
I can see I am getting close to the stage where it can works...hope someone
can help me again to understand this area where I am really a newbie, still.
Thanks
Gerald
On 7/6/06, Randy George <rkgeorge@anonymised.com> wrote:
Hi Gerald,
One further caveat, if you are planning to use the WFS service as
well as the WMS you will probably want to just convert your geometry to SRS
4326. The re-projection capability of WFS is evidently defined at OGC
(WFS1.1) and plans to implement in GeoServer appear to be down the road
slightly with 1.4.?
I. If you want GeoServer WMS to recognize your CRS you will need to add
some information to GeoServer since I don't think this is a common EPSG.
You would need to modify the gt2-epsg.jar adding a new custom CRS definition
to the end of the \org\geotools\referencing\crs\epsg.properties file.
For example substituting your Macau Special Administration parameters and
making use of the existing EPSG Datum 104106:
104309=PROJCS["Macau Special Admin",
GEOGCS["GCS_Datum_Lisboa_Hayford",DATUM["D_Datum_Lisboa_Hayford",SPHEROID["I
nternational_1924",6378388,297]],PRIMEM["Greenwich",0],UNIT["Degree",
0.01745
3292519943295],AUTHORITY["ESRI","104106"]]
,PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",22.212222]
,PARAMETER["central_meridian",113.536389
],PARAMETER["scale_factor",1.0],PARA
METER["false_easting",20000],PARAMETER["false_northing",20000],UNIT["metre",
1,AUTHORITY["EPSG","9001"]],AUTHORITY["Macau Special Admin","104309"]]
(Note that I didn't check this against real data)
II. If you want both WMS and WFS to serve your data source you should
transform your datastore geometry to 4326 (or wait for 1.4.? release).
If you have a coord transform package with your CRS you could just
change from the Macau CRS to 4326. Another way to do this if you have
PostGIS is to add a new record to the spatial_ref_sys of your database.
Looking at the Macau Special Administration parameters you listed, I
think you could take 'ESRI 102160' from the modified spatial_ref_sys table
of PostGIS and modify it with your origin and false easting,northing.
Latitude of Origin : 22º 12' 44'' N = 22.212222
Longitude of Origin : 113º 32' 11'' E = 113.536389
False Easting : 20,000.000 m (meters) [X=x+20,000.000 m]
False Northing : 20,000.000 m (meters) [Y=y+20,000.000 m]
For example changing from 102160 ESRI in the PostGIS spatial_ref_sys table
you would have something like this:
INSERT INTO spatial_ref_sys (srid, auth_name, auth_srid, srtext, proj4text)
VALUES (104309, 'Macau Special Admin', 104309,
'PROJCS["Datum_73_Hayford_Gauss_IGeoE",GEOGCS["GCS_Datum_73",DATUM["D_Datum_
73",SPHEROID["International_1924",6378388,297]],PRIMEM["Greenwich",0],UNIT["
Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["
False_Easting",
20000.0],PARAMETER["False_Northing",20000.0],PARAMETER["Centr
al_Meridian",113.536389],PARAMETER["Scale_Factor",1],PARAMETER["Latitude_Of_
Origin",39.66666666666666],UNIT["Meter",1]]', '+proj=tmerc +lat_0= 22.212222
+lon_0=113.536389 +k=1.000000 +x_0=20000.0 +y_0=20000.0 +ellps=intl
+units=m');
Once you have your CRS defined in the spatial_ref_sys you should be able to
get the transformed coordinates like this:
SELECT asewkt(transform(the_geom),4326) from your_table;
I hope this helps more than hinders, but when you have a non standard
coordinate system it does take some playing around to get things to work. I
know this from recent experience and Chris Holmes helpfully pointed out that
the WFS re-projection is a future feature.
Thanks
Randy George
www.cadmaps.com
-----Original Message-----
From: geoserver-users-bounces@lists.sourceforge.net
[mailto:geoserver-users-bounces@lists.sourceforge.net>
geoserver-users-bounces@lists.sourceforge.net] On Behalf Of Brent
Owens
Sent: Tuesday, July 04, 2006 9:23 AM
To: Gerald Estadieu
Cc: geoserver-users@lists.sourceforge.net
Subject: Re: [Geoserver-users] newbie on projection/datum
You should always tell geoserver what projection your data is in, even
if it is the regular 4326 lat/lon projection. The data in the database
should also be in the same projection and you should specify that in
postgis.
When a request comes in from mapbuilder or udig, a "requested" SRS value
is sent. Geoserver will look at that value, then look at the SRS of the
data. If they are different, it will reproject the data for you into the
"requested" projection.
Brent Owens
(The Open Planning Project)
Gerald Estadieu wrote:
Hi all,
I know it is not the first time someone ask this kind of question but
I still need some clarification from some experts here. I have a
dataset from Macao to setup a demo on PostGIS/Geoserver +
mapBuilder/uDig as a feasibility study. I got the all thing in
shapefiles without any .prj file but I got a document with the following:======================================================
CoordinatesProjection of Special Administrative Region of Macau
Transverse Mercator Projection.
Ellipsoid:
· International Hayford (a = 6,378, 388.000 m, 1/f = 297.00000000000)
· WGS-84 (World Geodetic System 1984) (a = 6,378,137.000 m, 1/f =
298.25722357000)Origin
The following "datum" has been taken as the origin of the network for
Special Administrative Region of Macau:Longitude: 113º 32' 11'' E
Latitude: 22º 12' 44'' Nand the following as the corresponding rectangular coordinates:
20 000.000 m N and 20 000.000 m E
Projection parameters
International Hayford
Reference Ellipsoid : a (Major semi-axis) = 6,378,388.000 m
f (Flattening) = 1/297
Projection : Transverse Mercator Projection
Latitude of Origin : 22º 12' 44'' N
Longitude of Origin : 113º 32' 11'' E
False Easting : 20,000.000 m (meters) [X=x+20, 000.000 m]
False Northing : 20,000.000 m (meters) [Y=y+20,000.000 m]
Datum Level : Mean Sea Level
Scale Factor : 1I imported all feature type in PostGIS but my SRID is -1 so far (which
is normal since I did not specify anything). I can access my data in
uDig/qGIS no problem when I use directly PostGIS but not when I use
GeoServer with mapbuilder (probably due to the missing CRS). In
Geoserver I declared my feature type in EPSG:4326 and everything has
been accepted and validated by GeoServer.
Here are a few questions I have to understand how to make the all
things properly in PostGIS and GeoServer
- Should I insert the CRS in PostGIS/Geoserver as defined above or it
is better to make a kind of "translation" in my data through some SQL
code to make it fit in the 4326 system?
- based on the above CRS definition how can I write it in the EPSG
format? I am not sure I understand how it is written. I believe I have
everything to do it but how? Good question!!! Again isn't it easier to
"translate" my data (since I can see that I have a North and East
translation). (something like GEOGCS["WGS 84", DATUM["WGS_1984",
SPHEROID["WGS 84", 6378137.0 , 298.257223563,
AUTHORITY["EPSG","7030"]], AUTHORITY["EPSG","6326"]],
PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]], UNIT["degree",
0.017453292519943295], AXIS["Lon", EAST], AXIS["Lat", NORTH],
AUTHORITY["EPSG","4326"]])I would appreciate some lights on my missing knowledge on this area!
Gerald
------------------------------------------------------------------------Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job
easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk
<http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642>
&kid=120709&bid=263057&dat=121642
------------------------------------------------------------------------
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job
easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk
<http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642>
&kid=120709&bid=263057&dat=121642
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users