Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add property projection to support coordinates provided in EPSG:27700 and EPSG:3857 #168

Merged
merged 14 commits into from
Aug 18, 2022

Conversation

jessicamcinchak
Copy link
Member

@jessicamcinchak jessicamcinchak commented Jul 28, 2022

**Per our dev call chat, opening this for review since it's a useful feature for the map component, even though it doesn't fix the example address marker & Ordnance Survey bug described in the attached Trello card.

Previously, we've assumed all coordinate properties (eg longitude, latitude, markerLongitude, markerLatitude) are provided in "EPSG:4326" (aka WGS84 / World Geodetic System).

This PR introduces a projection property that defaults to "EPSG:4326" and additionally accepts "EPSG:27700" (aka OSGB 1936 / British National Grid) or "EPSG:3857" (aka WGS84 / Web Mercator). We assume that all coordinate properties are provided in the same projection.

Coordinates provided in either projection will be translated to "EPSG:3857" to be rendered as a feature per openlayers & web mapping standards.

Example:

<my-map 
    zoom="20" 
    projection="EPSG:27700" 
    longitude="536227"
    latitude="180489" 
    showMarker
    markerLongitude="536227" 
    markerLatitude="180489" 
/>

@netlify
Copy link

netlify bot commented Jul 28, 2022

Deploy Preview for oslmap ready!

Name Link
🔨 Latest commit bf09852
🔍 Latest deploy log https://app.netlify.com/sites/oslmap/deploys/62fd36c2d6334b0008a8ada6
😎 Deploy Preview https://deploy-preview-168--oslmap.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@jessicamcinchak
Copy link
Member Author

@jessicamcinchak jessicamcinchak changed the title feat: add property projection to support coordinates provided in EPSG:27700 feat: add property projection to support coordinates provided in EPSG:27700 and EPSG:3857 Aug 4, 2022
"+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 " +
"+x_0=400000 +y_0=-100000 +ellps=airy " +
"+datum=OSGB36 +units=m +no_defs"
);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also tried this alternate proj4 definition I found, but it put the marker for 233a Rotherhithe St about 1 block south-east (rather than 1 lot west, which is current error)

// https://epsg.io/27700
proj4.defs(
   "EPSG:27700",
   "+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 " +
     "+x_0=400000 +y_0=-100000 +ellps=airy " +
     "+nadgrids=OSTN15_NTv2_OSGBtoETRS.gsb " +
     "+units=m +no_defs +type=crs"
);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +nadgrids=OSTN15_NTv2_OSGBtoETRS.gsb +units=m +no_defs +type=crs is what's given by EPSG.io - https://epsg.io/27700.proj4

@jessicamcinchak
Copy link
Member Author

Netlify CI is expected to fail here on new commits because I've updated our site's build/deploy settings over here: #61 (unfortuantely it's a global setting, not per branch).

Once that merges and this is rebased, I think it should be able to build again.

@jessicamcinchak jessicamcinchak marked this pull request as ready for review August 17, 2022 18:46
@jessicamcinchak jessicamcinchak requested a review from a team August 17, 2022 18:46
Copy link
Contributor

@DafyddLlyr DafyddLlyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@jessicamcinchak jessicamcinchak merged commit 8150b15 into main Aug 18, 2022
@jessicamcinchak jessicamcinchak deleted the jess/support-projection-27700 branch August 18, 2022 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants