Re: [gdal-dev] How do I add a projection to proj 8?

2024-04-14 Thread Even Rouault via gdal-dev

Stephen,

there are 2 possiblities:

- you may reuse your modified /usr/share/proj/epsg file from PROJ.4. But 
in this case, the EPSG entries of proj.db will not be used, so you will 
use only legacy CRS and transformations


- or you add a custom entry in proj.db

For the later, the following will output SQL statements that should be 
put in the DB, but they need a bit of tweaking given that the logic that 
suggests the SQL statements try to set a "proper" CRS definition which 
lacks the PROJ.4 +over or +nadgrids=@null hack


projinfo --output-id EPSG:900914 -o SQL -q "+proj=merc +a=6371001 
+b=6371001 +lat_ts=0.0 +lon_0=0.0 +x_0=-4448 +y_0=-4448 +k=1.0 +units=m 
+over +nadgrids=@null +no_defs +type=crs"


With a bit of hand tuning, if you run the following statements in your 
proj.db,


INSERT INTO ellipsoid 
VALUES('EPSG','ELLPS_GEODETIC_DATUM_GEODETIC_CRS_900914','unknown','','IAU_2015','399',6371001,'EPSG','9001',NULL,6371001,0);
INSERT INTO geodetic_datum 
VALUES('EPSG','GEODETIC_DATUM_GEODETIC_CRS_900914','unknown using 
nadgrids=@null','','EPSG','ELLPS_GEODETIC_DATUM_GEODETIC_CRS_900914','EPSG','8901',NULL,NULL,NULL,NULL,NULL,0);
INSERT INTO usage 
VALUES('EPSG','USAGE_GEODETIC_DATUM_GEODETIC_CRS_900914','geodetic_datum','EPSG','GEODETIC_DATUM_GEODETIC_CRS_900914','PROJ','EXTENT_UNKNOWN','PROJ','SCOPE_UNKNOWN');
INSERT INTO geodetic_crs 
VALUES('EPSG','GEODETIC_CRS_900914','unknown','','geographic 
2D','EPSG','6424','EPSG','GEODETIC_DATUM_GEODETIC_CRS_900914',NULL,0);
INSERT INTO usage 
VALUES('EPSG','USAGE_GEODETIC_CRS_900914','geodetic_crs','EPSG','GEODETIC_CRS_900914','PROJ','EXTENT_UNKNOWN','PROJ','SCOPE_UNKNOWN');
INSERT INTO projected_crs VALUES('EPSG','900914','unknown 
(900914)','',NULL,NULL,'EPSG','GEODETIC_CRS_900914',NULL,NULL,'+proj=merc 
+a=6371001 +b=6371001 +lat_ts=0.0 +lon_0=0.0 +x_0=-4448 +y_0=-4448 
+k=1.0 +units=m +over +nadgrids=@null +no_defs',0);
INSERT INTO usage 
VALUES('EPSG','USAGE_PROJECTED_CRS_900914','projected_crs','EPSG','900914','PROJ','EXTENT_UNKNOWN','PROJ','SCOPE_UNKNOWN');


you'll get:

PROJ_DATA=/tmp bin/projinfo EPSG:900914
PROJ.4 string:
+proj=merc +a=6371001 +b=6371001 +lat_ts=0 +lon_0=0 +x_0=-4448 
+y_0=-4448 +k=1 +units=m +nadgrids=@null +wktext +no_defs +type=crs


WKT2:2019 string:
PROJCRS["unknown (900914)",
    BASEGEOGCRS["unknown",
    DATUM["unknown using nadgrids=@null",
    ELLIPSOID["unknown",6371001,0,
    LENGTHUNIT["metre",1]]],
    PRIMEM["Greenwich",0,
    ANGLEUNIT["degree",0.0174532925199433]]],
    CONVERSION["unknown",
    METHOD["Popular Visualisation Pseudo Mercator",
    ID["EPSG",1024]],
    PARAMETER["Latitude of natural origin",0,
    ANGLEUNIT["degree",0.0174532925199433],
    ID["EPSG",8801]],
    PARAMETER["Longitude of natural origin",0,
    ANGLEUNIT["degree",0.0174532925199433],
    ID["EPSG",8802]],
    PARAMETER["False easting",-4448,
    LENGTHUNIT["metre",1],
    ID["EPSG",8806]],
    PARAMETER["False northing",-4448,
    LENGTHUNIT["metre",1],
    ID["EPSG",8807]]],
    CS[Cartesian,2],
    AXIS["(E)",east,
    ORDER[1],
    LENGTHUNIT["metre",1]],
    AXIS["(N)",north,
    ORDER[2],
    LENGTHUNIT["metre",1]],
    ID["EPSG",900914]]

Even

Le 12/04/2024 à 23:24, Stephen Woodbridge via gdal-dev a écrit :

Hi all,

I've been gone for a while, but got called back to update a site I 
built and need to move from proj4 to proj 8 on Ubuntu 22.04. In the 
past I just added the following to /usr/share/proj/epsg


# HYCOM Mercator projection
<900914> +proj=merc +a=6371001 +b=6371001 +lat_ts=0.0 +lon_0=0.0 
+x_0=-4448 +y_0=-4448 +k=1.0 +units=m +over +nadgrids=@null +no_defs  <>


and was able to access it in gdal, mapserver, postgis, etc with 
"EPSG:900914"


How does one do that with the new system?

Thanks,
  -Steve W

 
	Virus-free.www.avast.com 
 



<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev


--
http://www.spatialys.com
My software is free, but my time generally not.
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] How do I add a projection to proj 8?

2024-04-13 Thread Stephen Woodbridge via gdal-dev

On 4/13/2024 1:26 PM, Javier Jimenez Shaw wrote:


On Sat, 13 Apr 2024 at 17:35, Stephen Woodbridge via gdal-dev 
 wrote:


Thanks, this is NOT the standard Web Mercator projection. I am
aware of EPSG:90013 and EPSG:3857. This projection is used with
HYCOM data that I have extracted into geotif files so that I can
accurately project that onto EPSG:3857. It took some fiddling with
the values to get to overlay visually correctly. HYCOM data is
weird in that it uses two different projections based on if the
data is above or below some latitude.

I found something like that in the Internet. But I was not sure it was 
the right one https://polar.ncep.noaa.gov/global/about/ It didn't 
specify the projections, just a short description as Arctic bi-polar 
patch north of 47N, and Mercator south of it.


Yes this what is happening with the HYCOM data. The projection 
definition in PROJ4 worked quite well for my case of web mapping in 
mapserver.


I do not know if you can specify a projection "in parts" respect to 
parallel 47. Maybe in WKT2.


Where did you found those parameters for the datum and projection? 
They are quite strange.


For the ellipsoid there are a few already with a similar radius:

SELECT * from ellipsoid where semi_major_axis BETWEEN 6371000 and 6371010

EPSG7035Sphere  
PROJEARTH   6371000.0   EPSG9001
6371000.0   1
EPSG7048GRS 1980 Authalic Sphere
PROJEARTH   6371007.0   EPSG9001
6371007.0   0
ESRI 	107047 	Sphere_GRS_1980_Mean_Radius 	Sphere with mean radius 
based on GRS80 	PROJ 	EARTH 	6371008.7714 	EPSG 	9001 	0.0 	

0


And datums

SELECT * from geodetic_datum where ellipsoid_code in (7035, 7048, 107047)

EPSG6035Not specified (based on Authalic Sphere)
EPSG7035EPSG8901




1
EPSG6047Not specified (based on GRS 1980 Authalic Sphere)   
EPSG7048EPSG8901




1
ESRI 	106047 	D_Sphere_GRS_1980_Mean_Radius 	GRS 1980 Mean Radius 
Sphere 	ESRI 	107047 	EPSG 	8901 	





0


and geographic crs

SELECT * from geodetic_crs where datum_code in (6035, 6047, 106047)

EPSG4035Unknown datum based upon the Authalic Sphere
geographic 2D   EPSG6402EPSG6035
1
EPSG4047Unspecified datum based upon the GRS 1980 Authalic Sphere   
geographic 2D   EPSG6422EPSG6047
1
ESRI104047  GCS_Sphere_GRS_1980_Mean_Radius 
geographic 2D   EPSG6422ESRI106047  
0

See that EPSG ones are deprecated. (surprisingly the ellipsoid 
EPSG:7048 is not deprecated, but the datum that uses it is deprecated).


On 4/13/2024 4:19 AM, Javier Jimenez Shaw via gdal-dev wrote:

If what you need is really EPSG:3857, yes, use it.

However I have seen strange parameters on your projection. The
radius of the sphere is the "average" 3671 km, and you set a
false easting and northing of just 4.4 km. Is that trying to
correct the radius of the sphere? I do not know why you need that.

Bas, are they really equivalent?

In proj you can convert to WKT1 (see that I added +type=crs):

projinfo "+proj=merc +a=6371001 +b=6371001 +lat_ts=0.0 +lon_0=0.0
+x_0=-4448 +y_0=-4448 +k=1.0 +units=m +over +nadgrids=@null
+no_defs  +type=crs" -o wkt1_gdal


Ok I get this adding by +type=crs but how do I add it to the proj
database so I can access it referencing it by something like
EPSG:90014?


Is a WKT string enough?

PROJCS["unknown",
    GEOGCS["unknown",
        DATUM["unknown using nadgrids=@null",
            SPHEROID["unknown",6371001,0]],
        PRIMEM["Greenwich",0,
            AUTHORITY["EPSG","8901"]],
        UNIT["degree",0.0174532925199433,
            AUTHORITY["EPSG","9122"]]],
    PROJECTION["Mercator_1SP"],
    PARAMETER["central_meridian",0],
    PARAMETER["scale_factor",1],
    PARAMETER["false_easting",-4448],
    PARAMETER["false_northing",-4448],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AXIS["Easting",EAST],
    AXIS["Northing",NORTH],
    EXTENSION["PROJ4","+proj=merc +a=6371001 +b=6371001 +lat_ts=0.0 
+lon_0=0.0 +x_0=-4448 +y_0=-4448 +k=1.0 +units=m +over +nadgrids=@null 
+no_defs"]]


(generated with the projinfo line from prev email) Using a geographic 
CRS as described above will make it nicer, and probably more compatible.


You can use it in QGIS for instance. I am not sure how does it behave 
in a GeoTIFF, as it has some special tags. You can try to generate the 
geotiff with gdal with that WKT, and see that happens.


About adding to proj.db as EPSG:900914, I am not sure of all the 
steps. But I would say that you have to create a datum and a 
geographic crs (or use one of the above), in addition to the 
projection 

Re: [gdal-dev] How do I add a projection to proj 8?

2024-04-13 Thread Javier Jimenez Shaw via gdal-dev
On Sat, 13 Apr 2024 at 17:35, Stephen Woodbridge via gdal-dev <
gdal-dev@lists.osgeo.org> wrote:

> Thanks, this is NOT the standard Web Mercator projection. I am aware of
> EPSG:90013 and EPSG:3857. This projection is used with HYCOM data that I
> have extracted into geotif files so that I can accurately project that onto
> EPSG:3857. It took some fiddling with the values to get to overlay visually
> correctly. HYCOM data is weird in that it uses two different projections
> based on if the data is above or below some latitude.
>
I found something like that in the Internet. But I was not sure it was the
right one https://polar.ncep.noaa.gov/global/about/ It didn't specify the
projections, just a short description as Arctic bi-polar patch north of
47N, and Mercator south of it.

I do not know if you can specify a projection "in parts" respect to
parallel 47. Maybe in WKT2.

Where did you found those parameters for the datum and projection? They are
quite strange.

For the ellipsoid there are a few already with a similar radius:

SELECT * from ellipsoid where semi_major_axis BETWEEN 6371000 and 6371010

EPSG 7035 Sphere
PROJ EARTH 6371000.0 EPSG 9001
6371000.0 1
EPSG 7048 GRS 1980 Authalic Sphere
PROJ EARTH 6371007.0 EPSG 9001
6371007.0 0
ESRI 107047 Sphere_GRS_1980_Mean_Radius Sphere with mean radius based on
GRS80 PROJ EARTH 6371008.7714 EPSG 9001 0.0
0

And datums

SELECT * from geodetic_datum where ellipsoid_code in (7035, 7048, 107047)

EPSG 6035 Not specified (based on Authalic Sphere)
EPSG 7035 EPSG 8901




1
EPSG 6047 Not specified (based on GRS 1980 Authalic Sphere)
EPSG 7048 EPSG 8901




1
ESRI 106047 D_Sphere_GRS_1980_Mean_Radius GRS 1980 Mean Radius Sphere ESRI
107047 EPSG 8901




0

and geographic crs

SELECT * from geodetic_crs where datum_code in (6035, 6047, 106047)

EPSG 4035 Unknown datum based upon the Authalic Sphere
geographic 2D EPSG 6402 EPSG 6035
1
EPSG 4047 Unspecified datum based upon the GRS 1980 Authalic Sphere
geographic 2D EPSG 6422 EPSG 6047
1
ESRI 104047 GCS_Sphere_GRS_1980_Mean_Radius
geographic 2D EPSG 6422 ESRI 106047
0

See that EPSG ones are deprecated. (surprisingly the ellipsoid EPSG:7048 is
not deprecated, but the datum that uses it is deprecated).

On 4/13/2024 4:19 AM, Javier Jimenez Shaw via gdal-dev wrote:
>
> If what you need is really EPSG:3857, yes, use it.
>
> However I have seen strange parameters on your projection. The radius of
> the sphere is the "average" 3671 km, and you set a false easting and
> northing of just 4.4 km. Is that trying to correct the radius of the
> sphere? I do not know why you need that.
>
> Bas, are they really equivalent?
>
> In proj you can convert to WKT1 (see that I added +type=crs):
>
> projinfo "+proj=merc +a=6371001 +b=6371001 +lat_ts=0.0 +lon_0=0.0
> +x_0=-4448 +y_0=-4448 +k=1.0 +units=m +over +nadgrids=@null +no_defs
>  +type=crs" -o wkt1_gdal
>
> Ok I get this adding by +type=crs but how do I add it to the proj
> database so I can access it referencing it by something like EPSG:90014?
>
>
Is a WKT string enough?

PROJCS["unknown",
GEOGCS["unknown",
DATUM["unknown using nadgrids=@null",
SPHEROID["unknown",6371001,0]],
PRIMEM["Greenwich",0,
AUTHORITY["EPSG","8901"]],
UNIT["degree",0.0174532925199433,
AUTHORITY["EPSG","9122"]]],
PROJECTION["Mercator_1SP"],
PARAMETER["central_meridian",0],
PARAMETER["scale_factor",1],
PARAMETER["false_easting",-4448],
PARAMETER["false_northing",-4448],
UNIT["metre",1,
AUTHORITY["EPSG","9001"]],
AXIS["Easting",EAST],
AXIS["Northing",NORTH],
EXTENSION["PROJ4","+proj=merc +a=6371001 +b=6371001 +lat_ts=0.0
+lon_0=0.0 +x_0=-4448 +y_0=-4448 +k=1.0 +units=m +over +nadgrids=@null
+no_defs"]]

(generated with the projinfo line from prev email) Using a geographic CRS
as described above will make it nicer, and probably more compatible.

You can use it in QGIS for instance. I am not sure how does it behave in a
GeoTIFF, as it has some special tags. You can try to generate the geotiff
with gdal with that WKT, and see that happens.

About adding to proj.db as EPSG:900914, I am not sure of all the steps. But
I would say that you have to create a datum and a geographic crs (or use
one of the above), in addition to the projection (conversion, parameters,
etc) and the projected crs. And then "compile" the database.
Is it worth it?
In case you modify proj.db, instead of using EPSG, you can create your own
authority, or use "PROJ" authority. It will be cleaner.



> Thanks,
>   -Steve
>
>
> On Sat, 13 Apr 2024 at 06:17, Sebastiaan Couwenberg via gdal-dev <
> gdal-dev@lists.osgeo.org> wrote:
>
>> On 4/12/24 11:24 PM, Stephen Woodbridge via gdal-dev wrote:
>> > and was able to access it in gdal, mapserver, postgis, etc with
>> > "EPSG:900914"
>>
>> I used to do that too, but switched to EPSG:3857 its non-deprecated
>> equivalent. I would recommend that instead of trying to keep using a
>> non-standard 

Re: [gdal-dev] How do I add a projection to proj 8?

2024-04-13 Thread Stephen Woodbridge via gdal-dev
Thanks, this is NOT the standard Web Mercator projection. I am aware of 
EPSG:90013 and EPSG:3857. This projection is used with HYCOM data that I 
have extracted into geotif files so that I can accurately project that 
onto EPSG:3857. It took some fiddling with the values to get to overlay 
visually correctly. HYCOM data is weird in that it uses two different 
projections based on if the data is above or below some latitude.


On 4/13/2024 4:19 AM, Javier Jimenez Shaw via gdal-dev wrote:

If what you need is really EPSG:3857, yes, use it.

However I have seen strange parameters on your projection. The radius 
of the sphere is the "average" 3671 km, and you set a false easting 
and northing of just 4.4 km. Is that trying to correct the radius of 
the sphere? I do not know why you need that.


Bas, are they really equivalent?

In proj you can convert to WKT1 (see that I added +type=crs):

projinfo "+proj=merc +a=6371001 +b=6371001 +lat_ts=0.0 +lon_0=0.0 
+x_0=-4448 +y_0=-4448 +k=1.0 +units=m +over +nadgrids=@null +no_defs 
 +type=crs" -o wkt1_gdal


Ok I get this adding by +type=crs but how do I add it to the proj 
database so I can access it referencing it by something like EPSG:90014?


Thanks,
  -Steve


On Sat, 13 Apr 2024 at 06:17, Sebastiaan Couwenberg via gdal-dev 
 wrote:


On 4/12/24 11:24 PM, Stephen Woodbridge via gdal-dev wrote:
> and was able to access it in gdal, mapserver, postgis, etc with
> "EPSG:900914"

I used to do that too, but switched to EPSG:3857 its non-deprecated
equivalent. I would recommend that instead of trying to keep using a
non-standard projection.

Kind Regards,

Bas

-- 
  GPG Key ID: 4096R/6750F10AE88D4AF1

Fingerprint: 8182 DE41 7056 408D 6146  50D1 6750 F10A E88D 4AF1

___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev


___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev



--
This email has been checked for viruses by Avast antivirus software.
www.avast.com___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] How do I add a projection to proj 8?

2024-04-13 Thread Javier Jimenez Shaw via gdal-dev
Yes, such CRS was used until EPSG:3857 was added
(900913 tries to mimic Google letters with numbers, as it was used by
google maps).

But the parameters given by Stephen are a bit different. Probably that's
why the number ends with 4

You can see the (deprecated) proj4 string of 900913 at
https://spatialreference.org/ref/epsg/900913/proj4.txt

On Sat, 13 Apr 2024 at 11:12, Sebastiaan Couwenberg via gdal-dev <
gdal-dev@lists.osgeo.org> wrote:

> On 4/13/24 10:19 AM, Javier Jimenez Shaw via gdal-dev wrote:
> > Bas, are they really equivalent?
> As far as I know they are, where one used to use EPSG:900913 they should
> now be using EPSG:3857, as 900913 is deprecated.
>
>   https://wiki.openstreetmap.org/wiki/Web_Mercator
>
> Kind Regards,
>
> Bas
>
> --
>   GPG Key ID: 4096R/6750F10AE88D4AF1
> Fingerprint: 8182 DE41 7056 408D 6146  50D1 6750 F10A E88D 4AF1
>
> ___
> gdal-dev mailing list
> gdal-dev@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] How do I add a projection to proj 8?

2024-04-13 Thread Sebastiaan Couwenberg via gdal-dev

On 4/13/24 10:19 AM, Javier Jimenez Shaw via gdal-dev wrote:

Bas, are they really equivalent?
As far as I know they are, where one used to use EPSG:900913 they should 
now be using EPSG:3857, as 900913 is deprecated.


 https://wiki.openstreetmap.org/wiki/Web_Mercator

Kind Regards,

Bas

--
 GPG Key ID: 4096R/6750F10AE88D4AF1
Fingerprint: 8182 DE41 7056 408D 6146  50D1 6750 F10A E88D 4AF1

___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] How do I add a projection to proj 8?

2024-04-13 Thread Javier Jimenez Shaw via gdal-dev
If what you need is really EPSG:3857, yes, use it.

However I have seen strange parameters on your projection. The radius of
the sphere is the "average" 3671 km, and you set a false easting and
northing of just 4.4 km. Is that trying to correct the radius of the
sphere? I do not know why you need that.

Bas, are they really equivalent?

In proj you can convert to WKT1 (see that I added +type=crs):

projinfo "+proj=merc +a=6371001 +b=6371001 +lat_ts=0.0 +lon_0=0.0
+x_0=-4448 +y_0=-4448 +k=1.0 +units=m +over +nadgrids=@null +no_defs
 +type=crs" -o wkt1_gdal


On Sat, 13 Apr 2024 at 06:17, Sebastiaan Couwenberg via gdal-dev <
gdal-dev@lists.osgeo.org> wrote:

> On 4/12/24 11:24 PM, Stephen Woodbridge via gdal-dev wrote:
> > and was able to access it in gdal, mapserver, postgis, etc with
> > "EPSG:900914"
>
> I used to do that too, but switched to EPSG:3857 its non-deprecated
> equivalent. I would recommend that instead of trying to keep using a
> non-standard projection.
>
> Kind Regards,
>
> Bas
>
> --
>   GPG Key ID: 4096R/6750F10AE88D4AF1
> Fingerprint: 8182 DE41 7056 408D 6146  50D1 6750 F10A E88D 4AF1
>
> ___
> gdal-dev mailing list
> gdal-dev@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] How do I add a projection to proj 8?

2024-04-12 Thread Sebastiaan Couwenberg via gdal-dev

On 4/12/24 11:24 PM, Stephen Woodbridge via gdal-dev wrote:
and was able to access it in gdal, mapserver, postgis, etc with 
"EPSG:900914"


I used to do that too, but switched to EPSG:3857 its non-deprecated 
equivalent. I would recommend that instead of trying to keep using a 
non-standard projection.


Kind Regards,

Bas

--
 GPG Key ID: 4096R/6750F10AE88D4AF1
Fingerprint: 8182 DE41 7056 408D 6146  50D1 6750 F10A E88D 4AF1

___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev