nettopologysuite / projnet4geoapi Goto Github PK
View Code? Open in Web Editor NEW.NET Spatial Reference and Projection Engine
License: GNU Lesser General Public License v2.1
.NET Spatial Reference and Projection Engine
License: GNU Lesser General Public License v2.1
Hi,
I'm having an issue updating references to GeoAPI and NTS since this project uses GeoAPI as well and there's a version conflict.
Can this project be a part of the the deploy process of NTS and GeoAPI as well?
@airbreather?
The bug is related to ConcatenatedTransform.Inverse() method, which has unexpected side effects on child transformations in the list. Because of the absense of deep cloning of child transformations in Clone(), the call of Invert() method on the cloned ConcatenatedTransform object leads to subsequent calls of Invert() on the original child transformations.
To fix this I suggest to reimplement ConcatenatedTransform.Inverse() method to make him create the new ConcatenatedTransform object from the subsequent calls of Inverse() on child transforms (not Invert()).
To complete the usage of FittedCoordinateSystem, we need an implementation for GeoAPI.CoordinateSystems.Transformation.IMathTransformFactory
I need to preface this by saying I am not an expert in the GIS domain. But I have been using ESRI.ArgGISRuntime in the past and the results returned by the NetTopologySuite are not the same as the ones returned by ESRI.
Now, either I don't use the code properly or there is a bug.
The output is quite different. Is there a reason for this? Am I using either library incorrectly?
If I try to transform the following point: 47.4073238, -120.5757999 from this WKT
WKT
GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
ESRI
var srFrom = new SpatialReference("GEOGCS[\"GCS_North_American_1983\",DATUM[\"D_North_American_1983\",SPHEROID[\"GRS_1980\",6378137,298.257222101]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.017453292519943295]]");
var srGPS = new SpatialReference(4326);
var newMapPoint = GeometryEngine.Project(new MapPoint(-120.5757999, 47.4073238, srFrom), srGPS) as MapPoint;
Console.WriteLine($"{newMapPoint.X} {newMapPoint.Y} {newMapPoint.Z}");
// Output: -120.575814456652 47.4073295963295 0
ProjNet4GeoAPI
var ctFac = new CoordinateTransformationFactory();
ICoordinateSystemFactory csFac = new ProjNet.CoordinateSystems.CoordinateSystemFactory();
ICoordinateSystem csSource = csFac.CreateFromWkt("GEOGCS[\"GCS_North_American_1983\",DATUM[\"D_North_American_1983\",SPHEROID[\"GRS_1980\",6378137,298.257222101]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.017453292519943295]]");
ICoordinateSystem csTarget = GeographicCoordinateSystem.WGS84;
var transform = ctFac.CreateFromCoordinateSystems(csSource, GeographicCoordinateSystem.WGS84);
var result = transform.MathTransform.Transform(new double[] { -120.5757999, 47.4073238 });
Console.WriteLine($"{result[0]} {result[1]} {result[2]}");
// Output: -120.5757999 47.4073238405132 0.00495647825300694
I am using ProjNET4GeoAPI 1.4.1
Looks like I pushed 1.4.0 without specifying a lower-bound for GeoAPI.CoordinateSystems
(i.e., the geoapiversion
variable here).
Yet another thing that would just go away after NetTopologySuite/NetTopologySuite#244
I have the following two function to convert from UTM to Lat/Lon and the other way around :
public static GeoPosition UtmToLatLon(double x, double y, int zone, bool isNorthernHemisphere)
{
IProjectedCoordinateSystem utmCoordSystem = ProjectedCoordinateSystem.WGS84_UTM(zone, isNorthernHemisphere);
IGeographicCoordinateSystem wgs84 = GeographicCoordinateSystem.WGS84;
CoordinateTransformationFactory ctFact = new CoordinateTransformationFactory();
var transform = ctFact.CreateFromCoordinateSystems(utmCoordSystem, wgs84);
var latLon = transform.MathTransform.Transform(new[] {x, y});
return new GeoPosition(latLon[1], latLon[0]);
}
public static UtmPosition LatLonToUtm(double latitude, double longitude)
{
var zone = CalcUtmZone(longitude);
var isNorthernHemisphere = latitude >= 0;
IProjectedCoordinateSystem utmCoordSystem = ProjectedCoordinateSystem.WGS84_UTM(zone, isNorthernHemisphere);
IGeographicCoordinateSystem wgs84 = GeographicCoordinateSystem.WGS84;
CoordinateTransformationFactory ctFact = new CoordinateTransformationFactory();
var transform = ctFact.CreateFromCoordinateSystems(wgs84, utmCoordSystem);
var lonLat = transform.MathTransform.Transform(new[] { longitude, latitude });
var latZone = UtmPosition.GetUtmLatitudeZoneLetter(latitude);
return new UtmPosition(lonLat[0], lonLat[1], zone, latZone);
}
Is there a way to get higher accuracy? I've noticed that I will input coordinates such as: 18 N 2000, 2000 they get translated to lat/lon (13 precision decimal places) for storage and when I want to display them as UTM again I convert and end up with : 17 N 688108.6 4864940.5
I'm curious as to why I end up in zone 17 N and think it may be a rounding issue.
I'm trying convert GPS coordinates to the Pseudo-Mercator system (because it works worldwide) and the Y coordinate is always off; the X coordinate matches all of the calculators I've tried.
CoordinateSystemFactory c = new CoordinateSystemFactory();
ICoordinateSystem target = c.CreateFromWkt(@"PROJCS[""WGS 84 / Pseudo - Mercator"",
GEOGCS[""WGS 84"",
DATUM[""WGS_1984"",
SPHEROID[""WGS 84"",6378137,298.257223563,
AUTHORITY[""EPSG"",""7030""]],
AUTHORITY[""EPSG"",""6326""]],
PRIMEM[""Greenwich"",0,
AUTHORITY[""EPSG"", ""8901""]],
UNIT[""degree"",0.0174532925199433,
AUTHORITY[""EPSG"", ""9122""]],
AUTHORITY[""EPSG"", ""4326""]],
PROJECTION[""Mercator_1SP""],
PARAMETER[""central_meridian"", 0],
PARAMETER[""scale_factor"", 1],
PARAMETER[""false_easting"", 0],
PARAMETER[""false_northing"", 0],
PARAMETER[""latitude_of_origin"",0],
UNIT[""metre"",1,
AUTHORITY[""EPSG"",""9001""]],
AXIS[""X"", EAST],
AXIS[""Y"", NORTH],
AUTHORITY[""EPSG"", ""3857""]]");
ICoordinateSystem source = c.CreateFromWkt(@"GEOGCS[""WGS 84"",
DATUM[""WGS_1984"",
SPHEROID[""WGS 84"",6378137,298.257223563,
AUTHORITY[""EPSG"",""7030""]],
AUTHORITY[""EPSG"",""6326""]],
PRIMEM[""Greenwich"",0,
AUTHORITY[""EPSG"", ""8901""]],
UNIT[""degree"",0.0174532925199433,
AUTHORITY[""EPSG"", ""9122""]],
AUTHORITY[""EPSG"", ""4326""]]");
CoordinateTransformationFactory trf = new CoordinateTransformationFactory();
ICoordinateTransformation tr = trf.CreateFromCoordinateSystems(source, target);
double[] pointOrigin = new double[] { -86.070885, 39.521519 };
double[] pointDesintation = new double[] { -88.025821, 41.979628 };
// Gives { X: -9581367.0903264079, Y: 4769456.3827050393 }
double[] originConvert = tr.MathTransform.Transform(pointOrigin);
// Gives { X: -9798989.5703798477, Y: 5129340.707539645 }
double[] destConvert = tr.MathTransform.Transform(pointDesintation);
If I use the calculator on https://epsg.io, the X value is correct but the Y value is off:
https://epsg.io/transform#s_srs=4326&t_srs=3857&x=-86.0708850&y=39.5215190
https://epsg.io/transform#s_srs=4326&t_srs=3857&x=-88.0258210&y=41.9796280
This changes the distance between these two points from the correct value of 318.99km to 420.57km, a pretty substantial difference. Any ideas about why the calculation is off by so much?
Hi, I'm getting the following warning when using this library:
warning NU1602: ProjNET4GeoAPI 1.4.0 does not provide an inclusive lower bound for dependency GeoAPI.CoordinateSystems. An approximate best match of GeoAPI.CoordinateSystems 1.7.5 was resolved.
Probably an easy fix, right?
Transforming { 260250.1764, 5032926.70968 };
from MTM Zone 8 (32188) should result with
{ -8245367.59940006, 5690242.1209997 };
instead I get:
{ -8245367.59940006, 5659787.51440455 };
I tired it on https://epsg.io/ and https://mygeodata.cloud/cs2cs/, both give me the correct coordinates. Can you help please?
`
[TestMethod]
public void TestGitHubIssue53()
{
string wktFrom = getWKTfromId(32188);
string wktTo = getWKTfromId(3857);
CoordinateSystemFactory coordinateSystemFactory = new CoordinateSystemFactory();
var _pcsFrom = coordinateSystemFactory.CreateFromWkt(wktFrom);
var _pcsTo = coordinateSystemFactory.CreateFromWkt(wktTo);
CoordinateTransformationFactory ctf = new CoordinateTransformationFactory();
var _geoTransWgs84 = ctf.CreateFromCoordinateSystems(_pcsFrom, _pcsTo);
var _geoTransTo = ctf.CreateFromCoordinateSystems(_pcsFrom, _pcsTo);
// act
double[] point = { 260250.1764, 5032926.70968 };
double[] pointFinal = { -8245367.59940006, 5690242.1209997 };
double[] r = _geoTransWgs84.MathTransform.Transform(point);
double[] rBack = _geoTransTo.MathTransform.Transform(pointFinal);
// assert
Assert.AreEqual(point[0], rBack[0], 1e-1);
Assert.AreEqual(point[1], rBack[1], 1e-1);
Assert.AreEqual(pointFinal[0], r[0], 1e-1);
Assert.AreEqual(pointFinal[1], r[1], 1e-1);
}
private static string getWKTfromId(int wktId)
{
var wc = new WebClient();
string url = string.Format("https://epsg.io/{0}.wkt", wktId);
string wkt = wc.DownloadString(url);
if (wkt.StartsWith("PROJCS") || wkt.StartsWith("GEOGCS"))
return wkt;
else
throw new Exception(string.Format("Can't find definition for projection id {0}", wktId));
}`
The WKT parser for projection definition fails to parse AuthorityCodes that are not qouted, so
["AuthorityCode", "31466"]
(1) works but ["AuthorityCode", 31466]
(2) does not.
I'm not sure what the spec for the wkt says, fact is that there are authority codes definded like (2) are out in the wild.
I am attempting to use a CoordinateSystemFactory in order to project a wgs84 latitude/longitude into a state plane coordinate system. I have tried using the current stable version (1.3.0.4) and a few 1.3.2 pre-release versions too.
This code generates a run-time exception:
CoordinateSystemFactory csFact = new CoordinateSystemFactory();
var nebraska = csFact.CreateFromWkt("PROJCS[\"NAD83(HARN) / Nebraska\",GEOGCS[\"NAD83(HARN)\",DATUM[\"NAD83_High_Accuracy_Regional_Network\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],AUTHORITY[\"EPSG\",\"6152\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.01745329251994328,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4152\"]],PROJECTION[\"Lambert_Conformal_Conic_2SP\"],PARAMETER[\"standard_parallel_1\",43],PARAMETER[\"standard_parallel_2\",40],PARAMETER[\"latitude_of_origin\",39.83333333333334],PARAMETER[\"central_meridian\",-100],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",0],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AUTHORITY[\"EPSG\",\"2819\"]]");
The exception message string is "'P' is not recognized."
I have tried many other WKT strings too, all with the same result.
I saw a similar issue here. That issue was apparently resolved by using version 1.3.2-pre1, but I have tried both 1.3.2-pre1 and 1.3.2-pre004 and the exception persists.
Is there any other way to transform to state plane coordinates that would bypass the parsing that CreateFromWkt() does?
I'm trying to convert coordinates from 31370 (Lambert72) to 4326 (Wgs84).
My input has XY and parsing to WKT gives me the following result;
POINT (107984.0377 159720.7285)
The output after conversion however is giving me XYZ and the following WKT;
POINT (3.773414706860081 50.746493659745141 42.610120716504753)
I would expect something XY.
Is there supposed to be a Z coördinate? Am I doing something wrong?
Is there a way of not getting a Z coordinate?
Repro code below;
var geometry = new Point(107984.0377, 159720.7285);
var source = new CoordinateSystemFactory()
.CreateFromWkt("PROJCS[\"Belge 1972 / Belgian Lambert 72\",GEOGCS[\"Belge 1972\",DATUM[\"Reseau_National_Belge_1972\",SPHEROID[\"International 1924\",6378388,297,AUTHORITY[\"EPSG\",\"7022\"]],TOWGS84[-106.869,52.2978,-103.724,0.3366,-0.457,1.8422,-1.2747],AUTHORITY[\"EPSG\",\"6313\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4313\"]],PROJECTION[\"Lambert_Conformal_Conic_2SP\"],PARAMETER[\"standard_parallel_1\",51.16666723333333],PARAMETER[\"standard_parallel_2\",49.8333339],PARAMETER[\"latitude_of_origin\",90],PARAMETER[\"central_meridian\",4.367486666666666],PARAMETER[\"false_easting\",150000.013],PARAMETER[\"false_northing\",5400088.438],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"X\",EAST],AXIS[\"Y\",NORTH],AUTHORITY[\"EPSG\",\"31370\"]]");
var lambertToWgs84Transformation = new CoordinateTransformationFactory()
.CreateFromCoordinateSystems(source, GeographicCoordinateSystem.WGS84);
var preWkt = geometry.AsText();
var converted = GeometryTransform.TransformGeometry(geometry.Factory, geometry, lambertToWgs84Transformation.MathTransform);
var postWkt = converted.AsText();
To a casual observer, it appears as if that's functionally equivalent to:
using (TextReader reader = new StringReader(wkt))
{
// code here
}
Hi the link on the home page to FAQ doesn't go to the FAQ any more.
Implementation of AngularUnit.EqualParams method compares RadiansPerUnits values without any tolerance. For some cases it tells that two instance of angular units are different.
Steps to follow:
For details see following unit test: ProjNetIssues.TestAngularUnitsEqualParamsIssue.
Writing these up really quickly because it's really late in the morning for me...
TransformList(IList<double[]>)
and Transform(double[])
seem outdatedTransform(ref double x, ref double y, ref double z)
, we can probably get rid of DimSource
and DimTarget
?
AffineTransform
could probably have its own non-abstract
versions of these properties.throw new NotImplementedException()
are unused, let's eliminate themXML
doesn't seem to be used, yet every MathTransform
subclass must implement it.WKT
for their own instance is awkward. Is there a better way to accomplish this goal?Transform(double x, double y)
/ Transform(double x, double y, double z)
when we could just point people to the versions that take in ref
parameters?
ref
aren't CLS-compliant.public void Transform(Span<XY> xys, Span<double> zs = default, int strideZ = 0)
).
Invert()
.Hi,
I'm trying to use the code in this library to implement a coordinate system transformation relevant to Israel.
The following wiki page describes it:
https://en.wikipedia.org/wiki/Israeli_Transverse_Mercator
I tried the following code but I can't get the required results:
Note: I wasn't sure what to put under central_meridian
so I used the UTM zone number for Israel which is 36, and after calculations it returns 33.
[TestMethod]
public void TestItmFromJerusalem()
{
var coordinateTransformFactory = new CoordinateTransformationFactory();
var coordinateSystemFactory = new CoordinateSystemFactory();
var parameters = new List<ProjectionParameter>
{
new ProjectionParameter("latitude_of_origin", 31.734393611111109123611111111111),
new ProjectionParameter("longitude_of_origin", 35.204516944444442572222222222222),
new ProjectionParameter("central_meridian", 33),
new ProjectionParameter("false_northing", 626907.390),
new ProjectionParameter("false_easting", 219529.584),
new ProjectionParameter("scale_factor", 1.0000067)
};
var itmGeo = coordinateSystemFactory.CreateGeographicCoordinateSystem("ITM", AngularUnit.Degrees, HorizontalDatum.ETRF89, // GRS80
PrimeMeridian.Greenwich, new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("North", AxisOrientationEnum.North));
var projection = coordinateSystemFactory.CreateProjection("Transverse_Mercator", "Transverse_Mercator", parameters);
var itm = coordinateSystemFactory.CreateProjectedCoordinateSystem("ITM", itmGeo, projection, LinearUnit.Metre,
new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("North", AxisOrientationEnum.North));
string wkt = "GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137,298.257223563]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.0174532925199433]]";
var wgs84 = CoordinateSystemWktReader.Parse(wkt, Encoding.UTF8) as ICoordinateSystem;
var jerusalem = new Coordinate(35.234383488170444, 31.776747919252124);
var transfrom = coordinateTransformFactory.CreateFromCoordinateSystems(wgs84, itm);
var transformed = transfrom.MathTransform.Transform(jerusalem);
Assert.AreEqual(222286, transformed.X, 10);
Assert.AreEqual(631556, transformed.Y, 10);
}
Is the supplied data in the wiki incorrect? and I doning something wrong? I've been trying to figure this out for 2 days with no progress...
WktStreamTokenizer fails to parse numeric value with exponent notation. Such value might be supported. See chapter 6.3.2 in in WKT decription document at http://docs.opengeospatial.org/is/12-063r5/12-063r5.html
WKT example: PARAM_MT["Affine",PARAMETER["num_row", 3],PARAMETER["num_col", 3],PARAMETER["elt_0_0", 6.12303176911189E-17]]
I get WKT from https://epsg.io/4326 and https://epsg.io/3857
However that codes throw me an exception when I try to use them:
private void changeSRID(Geometry item, out double lat, out double lng)
{
//From coordinate sytem 4326
var wkt4326 = "GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\", 6378137, 298.257223563,AUTHORITY[\"EPSG\", \"7030\"]],AUTHORITY[\"EPSG\", \"6326\"]],PRIMEM[\"Greenwich\", 0,AUTHORITY[\"EPSG\", \"8901\"]],UNIT[\"degree\", 0.0174532925199433,AUTHORITY[\"EPSG\", \"9122\"]],AUTHORITY[\"EPSG\", \"4326\"]]";
GeoAPI.CoordinateSystems.IGeographicCoordinateSystem fromCS =
ProjNet.Converters.WellKnownText.CoordinateSystemWktReader.Parse(wkt4326, Encoding.UTF8) as GeoAPI.CoordinateSystems.IGeographicCoordinateSystem;
//To Corordinate system 3857
var wkt3857 = "PROJCS[\"WGS 84 / Pseudo-Mercator\",GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4326\"]],PROJECTION[\"Mercator_1SP\"],PARAMETER[\"central_meridian\",0],PARAMETER[\"scale_factor\",1],PARAMETER[\"false_easting\",0],PARAMETER[\"false_northing\",0],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"X\",EAST],AXIS[\"Y\",NORTH],EXTENSION[\"PROJ4\",\"+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs\"],AUTHORITY[\"EPSG\",\"3857\"]]";
GeoAPI.CoordinateSystems.IProjectedCoordinateSystem toCS =
ProjNet.Converters.WellKnownText.CoordinateSystemWktReader.Parse(wkt3857, Encoding.UTF8) as GeoAPI.CoordinateSystems.IProjectedCoordinateSystem;
//Transformation
CoordinateTransformationFactory ctfac = new CoordinateTransformationFactory();
ICoordinateTransformation trans = ctfac.CreateFromCoordinateSystems(fromCS, toCS);
double[] fromPoint = new double[] { item.Coordinates[0].X, item.Coordinates[0].Y };
double[] toPoint = trans.MathTransform.Transform(fromPoint);
lat = toPoint[0];
lng = toPoint[1];
}
I take a look to SRID.csv file of your project, but i couldn't find any ID with 3857.
So, Where can I find the correct WKT for both SRIDs?
CoordinateSystemFactory currently adopts a single default WGS84ConversionInfo
per GeographicCoordinateSystem
as defined in the WKT (eg SharpMap SpatialRefSys.xml)
It is not uncommon for a GCS to have several different known transformations and GeographicCoordinateSystem
has obviously been built with this in mind by exposing properties NumConversionToWGS84
and GetWgs84ConversionInfo
(see here).
It doesn't seem like this has ever been implemented and I am happy to contribute subject to further discussion / direction (realize this might not be the best time due to focus on supporting Net Standard, so no problems if people aren't available).
My initial questions are:
Regards
Tim
I know I can use your proyect in an EF Core project, as you comment here: NetTopologySuite/GeoAPI#71 (comment)
However NetTopologySuite, has a special nugget for core: NetTopologySuite.Core
. Using this nugget throws some exception on running. For example, this piece of code:
public static void from3857to4326(Geometry item, out double lat, out double lng)
{
// Coordinate systems
var cs4326 = GeographicCoordinateSystem.WGS84;
var cs3857 = ProjectedCoordinateSystem.WebMercator;
// Transformation
var ctfac = new CoordinateTransformationFactory();
var trans = ctfac.CreateFromCoordinateSystems(cs3857, cs4326);
double[] fromPoint = new double[] { item.Coordinates[0].X, item.Coordinates[0].Y };
double[] toPoint = trans.MathTransform.Transform(fromPoint);
lng = toPoint[0];
lat = toPoint[1];
}
Throws this exception:
Method not found: 'GeoAPI.Geometries.Coordinate[] NetTopologySuite.Geometries.Geometry.get_Coordinates()'.'
So,
NetTopologySuite
instead of NetTopologySuite.Core
?NetTopologySuite.Core
?When I attempt to create a ICoordinateTransformation to transform from 2053 to 4326 I get the exception: {"Projection Transverse_Mercator_South_Orientated is not supported."}
Both 2053 and 4326 are provided by the standard SRID.CSV file.
Is there maybe a workaround?
Thx...
CoordinateSystemFactory csFact = new CoordinateSystemFactory();
CoordinateTransformationFactory ctFact = new CoordinateTransformationFactory();
ICoordinateSystem CSSrc1 = ProjNet.UnitTests.SRIDReader.GetCSbyID(2053);
ICoordinateSystem CSTrg1 = ProjNet.UnitTests.SRIDReader.GetCSbyID(4326);
ICoordinateTransformation trans = ctFact.CreateFromCoordinateSystems(CSSrc1, CSTrg1); // exception
After #49, both GeoAPI and this project have their own IProjection
. Since NTS uses GeoAPI's I cannot use Projections from here with NTS.
The following is the code I'm using to create a math transform:
public static IMathTransform Create()
{
var coordinateTransformFactory = new CoordinateTransformationFactory();
var coordinateSystemFactory = new CoordinateSystemFactory();
var itmParameters = new List<ProjectionParameter>
{
new ProjectionParameter("latitude_of_origin", 31.734393611111109123611111111111),
new ProjectionParameter("central_meridian", 35.204516944444442572222222222222),
new ProjectionParameter("false_northing", 626907.390),
new ProjectionParameter("false_easting", 219529.584),
new ProjectionParameter("scale_factor", 1.0000067)
};
var itmDatum = coordinateSystemFactory.CreateHorizontalDatum("Isreal 1993", DatumType.HD_Geocentric,
Ellipsoid.GRS80, new Wgs84ConversionInfo(-24.0024, -17.1032, -17.8444, -0.33077, -1.85269, 1.66969, 5.4248));
var itmGeo = coordinateSystemFactory.CreateGeographicCoordinateSystem("ITM", AngularUnit.Degrees, itmDatum,
PrimeMeridian.Greenwich, new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("North", AxisOrientationEnum.North));
var itmProjection = coordinateSystemFactory.CreateProjection("Transverse_Mercator", "Transverse_Mercator", itmParameters);
var itm = coordinateSystemFactory.CreateProjectedCoordinateSystem("ITM", itmGeo, itmProjection, LinearUnit.Metre,
new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("North", AxisOrientationEnum.North));
var wgs84 = ProjectedCoordinateSystem.WGS84_UTM(36, true).GeographicCoordinateSystem;
return coordinateTransformFactory.CreateFromCoordinateSystems(itm, wgs84).MathTransform;
}
The following is the code, when I tried to run it from immediate window , _itmWgs84MathTransform
is the an instance created with the above factory:
_itmWgs84MathTransform.Transform(new Coordinate(200000,600000))
Correct results:
{(34.999654105859982, 31.491929780294662, NaN)}
CoordinateValue: {(34.999654105859982, 31.491929780294662, NaN)}
X: 34.999654105859982
Y: 31.491929780294662
Z: NaN
_itmWgs84MathTransform.Inverse().Transform(new Coordinate(35,32))
Correct results:
{(200138.59858848609, 656336.21658061759, NaN)}
CoordinateValue: {(200138.59858848609, 656336.21658061759, NaN)}
X: 200138.59858848609
Y: 656336.21658061759
Z: NaN
Instance is now corrupted:
_itmWgs84MathTransform.Transform(new Coordinate(200000,600000))
Bad results:
{(2.9315235171991696, -27.2988002073075, NaN)}
CoordinateValue: {(2.9315235171991696, -27.2988002073075, NaN)}
X: 2.9315235171991696
Y: -27.2988002073075
Z: NaN
BTW calling the following code fixes the issue:
_itmWgs84MathTransform.Inverse().Inverse()
I can probably send a pull request if needed, assuming someone will direct me to the right place to look for this.
Hello,
i'm trying to improve coordinate transformation from 'Gauss-Kruger zone 2' to UTM32 by using a nadgrids file. the file is stored in the directory of the application.
i found a WKT with this EXTENSION and '+nadgrids=@null' so i tried to extend my WKT.
helas, no change of the output.
any clues to use a nadgrids file?
VB-Code:
Dim GK2WKT = "PROJCS[""DHDN / 3-degree Gauss-Kruger zone 2"",GEOGCS[""DHDN"",DATUM[""Deutsches_Hauptdreiecksnetz"",SPHEROID[""Bessel 1841"",6377397.155,299.1528128,AUTHORITY[""EPSG"",""7004""]],TOWGS84[598.1,73.7,418.2,0.202,0.045,-2.455,6.7],AUTHORITY[""EPSG"",""6314""]],PRIMEM[""Greenwich"",0,AUTHORITY[""EPSG"",""8901""]],UNIT[""degree"",0.0174532925199433,AUTHORITY[""EPSG"",""9122""]],AUTHORITY[""EPSG"",""4314""]],UNIT[""metre"",1,AUTHORITY[""EPSG"",""9001""]],PROJECTION[""Transverse_Mercator""],PARAMETER[""latitude_of_origin"",0],PARAMETER[""central_meridian"",6],PARAMETER[""scale_factor"",1],PARAMETER[""false_easting"",2500000],PARAMETER[""false_northing"",0],EXTENSION[""PROJ4"",""+proj=tmerc +lat_0=0 +lon_0=9 +k=1 +x_0=2500000 +y_0=0 +ellps=bessel +datum=potsdam +units=m +no_defs **+nadgrids=./BETA2007.gsb""**],AUTHORITY[""EPSG"",""31466""],AXIS[""X"",NORTH],AXIS[""Y"",EAST]]"
Dim csGK2 As GeoAPI.CoordinateSystems.ICoordinateSystem = _
ProjNet.Converters.WellKnownText.CoordinateSystemWktReader.Parse(GK2WKT)
Dim csUTM32 As GeoAPI.CoordinateSystems.ICoordinateSystem = _
ProjNet.CoordinateSystems.ProjectedCoordinateSystem.WGS84_UTM(32, True)
Dim ctfac_Wgs84_Gk2 As ProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory = _
New ProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory()
Dim ct_Gk2_Utm As GeoAPI.CoordinateSystems.Transformations.ICoordinateTransformation = _
ctfac_Gk2_Utm.CreateFromCoordinateSystems(csGK2, csUTM32)
Dim toPoint As Double() = ct_Gk2_Utm.MathTransform.Transform(New Double() {2405675.77, 5804339.69})
This is useful when going from WGS84 to WGS84_UTM because you don't know the zone.
I tried to transform coordinations in 'Gauss_Kruger' projection by replacing it with 'Transverse_Mercator'. The deviation of result is too large. Bursa model with seven parameters is usually used in my daily work to tranform coordinations in 'Gauss_Kruger' projection. Pardon me for my ignorance. What's the different to implement 'BursaTransform.cs'? Is there a plan to implement it?
Hi,
This libary is great! Great job.
In my case I am dealing with this CRS: https://epsg.io/2056 - it uses Hotine Oblique Mercator Azimuth Center projection, which is not supported. This is how I transform between CRS:
var trans = (new CoordinateTransformationFactory()).CreateFromCoordinateSystems(sourcePoint.CoordinateSystem, targetCoordinateSystem);
var sourcePointTemp = new[]
{
sourcePoint.LongitudeOrEasting,
sourcePoint.LatitudeOrNorthing
};
var targetPoint = trans.MathTransform.Transform(sourcePointTemp);
If both the source and the target CRS are the same, there is no transformation needed. I would expect that the transformation factory would just return the source point in this case. But instead, it throws an exception (because my CRS is not supported).
Would it make sense to change this behavior? i would be very happy to create a PR if you agree.
Thanks!
This issue affects NetTopologySuite GeometryTransform. To reproduce:
var geometryServices = new NtsGeometryServices();
var geometryFactory = geometryServices.CreateGeometryFactory();
var coordinateTransformationFactory = new CoordinateTransformationFactory();
var transform = coordinateTransformationFactory.CreateFromCoordinateSystems(
GeographicCoordinateSystem.WGS84,
GeocentricCoordinateSystem.WGS84
);
var sequence = geometryFactory.CoordinateSequenceFactory.Create(
new[] { new Coordinate(-75.212144, 39.952874, 1000) });
var convertedSequence = transform.MathTransform.Transform(sequence);
Console.WriteLine("Original : {0}\nConverted: {1}", sequence, convertedSequence);
Output:
Original : ((1249872.4843066079, -4734640.5686484585, 4074617.9450782747))
Converted: ((1249872.4843066079, -4734640.5686484585, 4074617.9450782747))
The CoordinateSystemWktReader does not currently support GEOCCS WKT strings. Please add support for reading these strings.
I have already made the changes and manually built the library so I could use this right away. If acceptable, I will post a pull request once I get something integrated into the project's unit tests.
Our SRID.csv
file is only used for tests, presumably because not all WKT strings in there are supported.
However, our default list only includes 4326 and 3857 at the time of writing. Maybe we could expand this to include all the rows from that file that actually work?
Version 1.3.0.4 of the library is plainly refusing to parse any WKT strings that are passed to CoordinateSystemWKTReader.Parse()
, and thus, to CoordinateSystemFactory.CreateFromWKT()
.
EDIT: The issue was found in the PCL version of the library. Other versions were not tested.
A snapshot of the project's sources taken today (Jan 19, 2017), however, works just fine. The problem seems to be the specific .dlls published as part of the 1.3.0.4 NuGet.
The exception that is thrown when one attempts to parse a WKT is the following:
(NOTE: 'P' corresponds to the first letter of whatever WKT string it's being sent to the function).
System.ArgumentException was unhandled by user code
HResult=-2147024809
Message='P' is not recognized.
Source=ProjNET
StackTrace:
at ProjNet.Converters.WellKnownText.CoordinateSystemWktReader.Parse(String wkt)
at ProjNet.CoordinateSystems.CoordinateSystemFactory.CreateFromWkt(String WKT)
at <yada, yada, yada, >
InnerException:
Hello.
1st of all -sorry for my ignorance, but geo transformations is something really alien to me, and I've probably messed up something somewhere. Anyway I've stuck on this task I have, and the results is not as I expect.-
My task it to get a correct tile address for Lambert tile out of openstreet map tile address.
I've started with the converting from google maps type of coordinates to lambert, but somewhere something is wrong..
I would appreciate any kind of help on this topic.
public static void testConvert()
{
CoordinateSystemFactory csFact = new CoordinateSystemFactory();
CoordinateTransformationFactory ctFact = new CoordinateTransformationFactory();
ICoordinateSystem BGS2005 = csFact.CreateFromWkt(
@"PROJCS[\"BGS2005\", GEOGCS[\"GCS_WGS_1984\", DATUM[\"D_WGS_1984\",
SPHEROID[\"WGS_1984\", 6378137.0, 298.257223563]], PRIMEM[\"Greenwich\", 0.0],
UNIT[\"degree\", 0.017453292519943295], AXIS[\"Longitude\", EAST], AXIS[\"Latitude\", NORTH]],
PROJECTION[\"Lambert_Conformal_Conic_2SP\"], PARAMETER[\"central_meridian\", 25.5],
PARAMETER[\"latitude_of_origin\", 42.66787568333], PARAMETER[\"standard_parallel_1\",
43.33333333333], PARAMETER[\"false_easting\", 500000.0], PARAMETER[\"false_northing\",
4725824.3591], PARAMETER[\"scale_factor\", 1.0], PARAMETER[\"standard_parallel_2\", 42.0],
UNIT[\"m\", 1.0], AXIS[\"x\", EAST], AXIS[\"y\", NORTH], AUTHORITY[\"EPSG\",\"8122\"]]" );
IProjectedCoordinateSystem utm35 = ProjectedCoordinateSystem.WGS84_UTM( 35, true );
ICoordinateTransformation trans = ctFact.CreateFromCoordinateSystems( BGS2005, utm35 );
double[] point = new[] { 42.5, 24.5 };
var r = trans.MathTransform.Transform( point );
}
I understand that ProjNet can handle the axis order (e.g. longitude-latitude or x-y) with AxisInfo
objects.
However, the order does not affect transformations, and it may result in failure on the projection with latitude-longitude or y-x order CSs.
This behavior is one of de facto standards and reasonable for backward compatibility, and I just don't want breaking change.
So does ProjNet keep the forward compatibility on axis order?
If so, I'll implement the axis switching in my code (i.e. outside of ProjNet) to support both GeoJSON (x-y order) and GML (depends on CS definition).
Is there a way to to calculate bearing and reverse bearing between points?
thanks!
Hi,
Could you tell me what licence this software is released under.
Thanks
Hi,
I noticed an unexpected behavior when working with this library. I tried to check whether 2 coordinate systems are the same:
var crs1 = GeographicCoordinateSystem.WGS84;
var crs2 = GeographicCoordinateSystem.WGS84;
crs1 == crs2; // False
crs1.Equals(crs2) // False
Since coordinate systems are reference types, I think it makes sense that crs1 != crs2
if they don't refer to the same reference. However, since the contents of crs1 and crs2 are the same, I think it would make sense if crs1.Equals(crs2)
is true
.
Is this behavior desired? If not, I'd be happy to create a pull request (if that's possible for backwards compatibility reasons?).
Andreas
I'm trying to convert an application that uses a proj4 library (C++) over to this library. The app converts various projections to/from GPS coordinates assuming WGS84 for the GPS coordinates. The code is using this proj4 init string: +proj=latlong +ellps=WGS84 +datum=NAD83
I can't find an appropriate WKT string for this. Upon researching, it seems that having WGS84 and NAD83 together isn't even valid. Is that true? I was planning on using GeographicCoordinateSystem.WGS84 to get the coordinate system, but my conversions are different by 2 degrees in the longitude and hundredth of degrees in latitude from the old code.
If there is an API that I missed that takes a proj4 string, please let me know.
Thanks.
Since #42 MathTransForm
has the following new public Transform
function overloads:
Transform(ReadonlySpan<double> xs, ReadonlySpan<double> ys, ReadonlySpan<double> zs, Span<double> outXs, Span<double> outYs, Span<double> outZs)
Transform(ReadonlySpan<XY> xys, ReadonlySpan<double> zs, Span<XY> outXys, Span<double> outZs)
Transform(ReadonlySpan<XYZ> xyzs, Span<XYZ> outXyzs)
XY
and XYZ
are tuples of doubles.
For the sake of more flexibility I'd rather go without XY
and XYZ
struct. While the case of a vector containing interchanging x- and y-ordinates and an additional z-ordinate vector an be handled efficiently, a case of a vector layout having x-, y, (,z-) and m-ordinate values is not doable without creating vectors and copying ordinate values around.
I propose we change ReadonlySpan and ReadonlySpan to ReadonlySpan and add int stepCoord
to the signature or add another overload:
Transform(ReadonlySpan<double> xys, int stepCoord, ReadonlySpan<double> zs, int offsetZ, int stepZ, Span<double> outXys, Span<double> outZs)
Transform(ReadonlySpan<double> xyzs, int stepCoord, Span<double> outXys, ReadonlySpan<double> outZs)
I use the PCL version of this project to convert Canada coodinates between geo location (WGS84) and projected location NAD83 .
When I convert from NAD83 to WGS84, it works fine. But when I convert it back from WGS84 to NAD83 it is wrong.
My test case taken from http://epsg.io/26910:
Latitude = 48.4185597
Longitude = -82.0479097
Easting = 3523562.711189
Northing = 6246615.391161
My code to convert to projection is like this:
string target_WKT = "PROJCS[\"NAD83 / UTM zone 10N\",GEOGCS[\"NAD83\",DATUM[\"North_American_Datum_1983\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6269\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4269\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",-123],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",0],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Easting\",EAST],AXIS[\"Northing\",NORTH],AUTHORITY[\"EPSG\",\"26910\"]]";
var coordinateSystem_WGS = GeographicCoordinateSystem.WGS84;
var coordinateSystem_Target = CoordinateSystemWktReader.Parse(target_WKT) as IProjectedCoordinateSystem;
CoordinateTransformationFactory ctfac = new CoordinateTransformationFactory();
ICoordinateTransformation trans = ctfac.CreateFromCoordinateSystems(coordinateSystem_WGS, coordinateSystem_Target);
double[] fromPoint = new double[] { input.Longitude, input.Latitude };
double[] toPoint = trans.MathTransform.Transform(fromPoint);
I expect the toPoint return the easting and northing as above but not.
Note that when convert projection to lat/lon it is correct.
Any help?
Example:
CoordinateSystemServices.cs(308,24,308,43): warning CS1591: Missing XML comment for publicly visible type or member 'CoordinateSystemServices.AddCoordinateSystem(int, CoordinateSystem)'
Unfortunately I'm getting a little frustrated. I am using .net standard 2.0 with GeoAPI 1.7.5, NettopologySuite 1.15.1 and ProjNet4GeoAPI 1.4.1
I am trying to get the distance between two latitude/longitude points in meters that I know to be roughly 10km apart in the united states. All of my calculations are done using the same two GeoAPI.Geometry.IPoint classes with correctly set X/Y values.
I have done the calculation with postGIS in a query window and gotten: 9052.83580248723 meters (using SRID 4326 to 2163 ST_Transform() and ST_Distance())
I've done the calculation by converting using the Distance() method between the two points (i get: 0.089028956413068211 which is degrees if I understand correctly) and apply generic multiplier from radians distance of 111.325 wherein I get: 9911.1485726848186 m
I've done the haversine algo wherein I get 1449.7855112772756 m
I've also been sitting here for about an hour with google trying to get the distance via point transform using Proj4Net between 4326 wgs84 and pretty much anything that the WKT specifies a unit of meter and I'm getting wildly different answers none of which match. The code I'm using (along with the last WKT I tried) is below. All I want is the distance between two points in meters....I'm of the mind that using the tools I am using this shouldn't be all that complicated so clearly I must be doing something wrong. Can anyone kick me in the right direction?
var originWKT = "GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.01745329251994328,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4326\"]]";
var targetWKT = "PROJCS[\"US National Atlas Equal Area\",GEOGCS[\"Unspecified datum based upon the Clarke 1866 Authalic Sphere\",DATUM[\"Not_specified_based_on_Clarke_1866_Authalic_Sphere\",SPHEROID[\"Clarke 1866 Authalic Sphere\",6370997,0,AUTHORITY[\"EPSG\",\"7052\"]],AUTHORITY[\"EPSG\",\"6052\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4052\"]],PROJECTION[\"Lambert_Azimuthal_Equal_Area\"],PARAMETER[\"latitude_of_center\",45],PARAMETER[\"longitude_of_center\",-100],PARAMETER[\"false_easting\",0],PARAMETER[\"false_northing\",0],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"X\",EAST],AXIS[\"Y\",NORTH],AUTHORITY[\"EPSG\",\"2163\"]]";
var coordinateSystemFactory = new ProjNet.CoordinateSystems.CoordinateSystemFactory();
var transformationFactory = new ProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory();
var originCoordinateSystem = coordinateSystemFactory.CreateFromWkt(originWKT);
var targetCoordinateSystem = coordinateSystemFactory.CreateFromWkt(targetWKT);
var transform = transformationFactory.CreateFromCoordinateSystems(originCoordinateSystem, targetCoordinateSystem);
var pointACoordinate = new GeoAPI.Geometries.Coordinate(pointA.X, pointA.Y);
var pointBCoordinate = new GeoAPI.Geometries.Coordinate(pointB.X, pointB.Y);
var newPointA = transform.MathTransform.Transform(pointACoordinate);
var newPointB = transform.MathTransform.Transform(pointBCoordinate);
result = newPointB.Distance(newPointA);
Hi,
For my use case, this coordinate system is very popular: https://epsg.io/2056 - it uses the Hotine Oblique Mercator Azimuth Center projection, which is currently not supported by this library.
I am relatively new to geodesy, but I would like to improve my skills and therefore implement this projection. I am currently reading a book on geodesy that has a chapter about this projection and also contains the maths behind it. I also have access to a lot of reference points in LV95 (EPSG 2056).
Before I work on this and create a PR, I would like to ask:
Thank you!
Andreas
We recently upgraded to dotnet core 3.0. We need GeoAPI in our api. We actually need this feature as fast as possible, to deploy in production.
What's needed :
Please answer me when i'ts done.
Thanks
I have tested transformation from WGS84 (EPSG 4326) to "RT90 2.5 gon V" (EPSG 3021) using the file "SRID.csv" and a "SridReader" like you suggested here:
https://github.com/NetTopologySuite/ProjNet4GeoAPI/wiki/Loading-a-projection-by-Spatial-Reference-ID
I used the following input WGS84 coordinate:
Longitude/Latitude: 18.059196 , 59.330231
The expected result should be the following:
X/Y: 1628294 , 6580994
The above coordinates is the result from e.g. these sites:
https://kartor.eniro.se
https://www.hitta.se/kartan
https://epsg.io/transform
https://mygeodata.cloud/cs2cs/
http://tasks.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer/project
When I use the "SRID.csv" shipped with ProjNet4GeoAPI I get the following result (skipping the decimals below):
X/Y: 1628102 , 6580875
The X/Y difference is 192/119 meters compared to the expected result (i.e. the result from the above websites).
The row for EPSG 3021 looks like this in the shipped file "SRID.csv":
3021;PROJCS["RT90 2.5 gon V",GEOGCS["RT90",DATUM["Rikets_koordinatsystem_1990",SPHEROID["Bessel 1841",6377397.155,299.1528128,AUTHORITY["EPSG","7004"]],AUTHORITY["EPSG","6124"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4124"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",15.80827777777778],PARAMETER["scale_factor",1],PARAMETER["false_easting",1500000],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AUTHORITY["EPSG","3021"]]
However, when I change the file to the following then the expected result is achieved:
3021;PROJCS["RT90 2.5 gon V",GEOGCS["RT90",DATUM["Rikets_koordinatsystem_1990",SPHEROID["Bessel 1841",6377397.155,299.1528128,AUTHORITY["EPSG","7004"]],TOWGS84[414.1,41.3,603.1,-0.855,2.141,-7.023,0],AUTHORITY["EPSG","6124"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4124"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",15.80827777777778],PARAMETER["scale_factor",1],PARAMETER["false_easting",1500000],PARAMETER["false_northing",0],AUTHORITY["EPSG","3021"],AXIS["X",NORTH],AXIS["Y",EAST]]
I found the above row by testing a definition I found at SharpMap's SpatialRefSys.xml:
https://github.com/SharpMap/SharpMap/blob/fdb61e5cb4133000f903ba40f8f0bb4d95bead39/SharpMap/Converters/WellKnownText/SpatialReference.cs
Uri("https://raw.githubusercontent.com/SharpMap/SharpMap/Branches/1.0/SharpMap/SpatialRefSys.xml")
The SpatialRefSys.xml contains this section for 3021:
<ReferenceSystem>
<SRID>3021</SRID>
<PROJ4>+proj=tmerc +lat_0=0 +lon_0=15.80827777777778 +k=1 +x_0=1500000 +y_0=0 +ellps=bessel +towgs84=414.1,41.3,603.1,-0.855,2.141,-7.023,0 +units=m +no_defs </PROJ4>
PROJCS["RT90 2.5 gon V",GEOGCS["RT90",DATUM["Rikets_koordinatsystem_1990",SPHEROID["Bessel 1841",6377397.155,299.1528128,AUTHORITY["EPSG","7004"]],TOWGS84[414.1,41.3,603.1,-0.855,2.141,-7.023,0],AUTHORITY["EPSG","6124"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4124"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",15.80827777777778],PARAMETER["scale_factor",1],PARAMETER["false_easting",1500000],PARAMETER["false_northing",0],AUTHORITY["EPSG","3021"],AXIS["X",NORTH],AXIS["Y",EAST]]
</ReferenceSystem>
Then I took the row with "PROJCS" and used in the "SRID.csv" after the "3021;" and then the result became correct.
Hi
First off, good job with this port!
I'm having issues transforming my geometry from 25832 to 3857.
I have a point:
x = 702575 y = 6153153 in epsg:25832
When i try to convert to epsg:3857 with this wkt string:
PROJCS["WGS 84 / Pseudo-Mercator",
GEOGCS["WGS 84",
DATUM["WGS_1984",
SPHEROID["WGS84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],
AUTHORITY["EPSG","6326"]],
PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],
UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],
AUTHORITY["EPSG","4326"]],
PROJECTION["Mercator_1SP"],
PARAMETER["central_meridian",0],
PARAMETER["scale_factor",1],
PARAMETER["false_easting",0],
PARAMETER["false_northing",0],
UNIT["metre",1,AUTHORITY["EPSG","9001"]],
AXIS["X",EAST],
AXIS["Y",NORTH],
EXTENSION["PROJ4","+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs"],
AUTHORITY["EPSG","3857"]]
I get x = 1358761 y = 7420836
which is about 36 km too much to the south..
I have tried different wkt strings found on the net, but i can't find one that works.
If i try epsg.io's transformer i get the expected results:
https://epsg.io/transform#s_srs=25832&t_srs=3857&x=702575.0000000&y=6153153.0000000
Also, my old native dll implementation of proj4.dll works as intenden.
Can you fix this issue or point me in the right direction to find a solution?
Thanks!
Michael Pallesen
Similar as GeoAPI.NETCore
I guess we need to setup a similar build system as we use in NTS/GeoAPI?
I have seen a start on the build server want me to finish up @FObermaier ?
Morton Nielsen is actualy Morten Nielsen :)
ProjNet4GeoAPI/src/ProjNet/ProjNET.csproj
Line 17 in f6d10e3
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.