Comments (6)
You beat me to the edit, you were right i had the wrong way round!
I think this would be a great addition to the documentation under the section this page as that's where I went to instinctively, thanks again!
from phpcoord.
Hello
For lat/long you want a Geographic
CRS (see https://www.phpcoord.net/en/stable/creating_points_geographic.html)
$toCRS = Geographic2D::fromSRID(Geographic2D::EPSG_WGS_84); GPS/Google maps
$to = $from->convert($toCRS);
or
$toCRS = Geographic2D::fromSRID(Geographic2D::EPSG_OSGB36); // OS maps, also Bing I think
$to = $from->convert($toCRS);
from phpcoord.
Actually https://www.phpcoord.net/en/stable/primer.html#coordinate-reference-systems-crss might be a better page in the docs to explain the different CRS types
from phpcoord.
Thanks for the fast response! If I run the following;
require __DIR__ . "/vendor/autoload.php";
use PHPCoord\CoordinateReferenceSystem\Projected;
use PHPCoord\ProjectedPoint;
use PHPCoord\UnitOfMeasure\Length\Metre;
use PHPCoord\CoordinateReferenceSystem\Geographic2D;
$from = ProjectedPoint::createFromEastingNorthing(
new Metre(92041),
new Metre(409722),
Projected::fromSRID(Projected::EPSG_OSGB36_BRITISH_NATIONAL_GRID)
);
$toCRS = Geographic2D::fromSRID(Geographic2D::EPSG_WGS_84); //GPS/Google maps
$to = $from->convert($toCRS);
echo $to;
I get
Unable to perform conversion, please file a bug if you think this is incorrect
from phpcoord.
new Metre(92041),
new Metre(409722),
I think you've got eastings/northings swapped
from phpcoord.
Awesome, had me worried for a second as I'm the UK too and I know that conversion is supposed to work...
That's a good suggestion about the docs, I'll add a projected->geographic example to it.
from phpcoord.
Related Issues (20)
- Calculations for grs80 to latlng HOT 4
- toWGS84() function HOT 1
- Accuracy of Lat/Lng to Easting/Northing HOT 2
- Load ten figure UK grid refs HOT 7
- Possibility to map UTM coordinates to a different zone? HOT 13
- ITM to WGS84 error
- Irish Grid to WGS84 problems HOT 6
- Library upgrade assistance HOT 3
- Uncaught Error: Class 'PHPCoord\CoordinateReferenceSystem\Projected' not found HOT 4
- License requirments of the EPSG dataset HOT 4
- I experience a memory leak HOT 2
- Accuracy of EPSG_AMERSFOORT_RD_NEW ⇒ EPSG_WGS_84 conversion HOT 23
- Division by zero HOT 2
- EPSG_AMERSFOORT_RD_NEW ⇒ EPSG_WGS_84 conversion no longer working HOT 6
- Can not convert from epsg:7415 to epsg:4979 HOT 2
- Retrieving Coordinate Systems to Display HOT 1
- deprecation warning php 8: Optional parameter ... declared before required parameter HOT 4
- Determine Point Type from CRS HOT 1
- Convert WGS 84 Coordinates to DHDN / 3-degree Gauss-Kruger zone 4 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phpcoord.