NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

0
1

I have some links to Google Maps that I want to replace with OpenStreetMap ones. They are of this form. I can enter the postcode into OSM, zoom in to show individual buildings, Share and 'include marker' to get a link like this It looks much better than the Google version. Only problem, I have 200 of them to convert! Is there a way to generate the OSM links from the UK postcode? Looking up the lat/long coords for each would be a pain and would require some scripting, and ideally I can generate usable OSM links by inserting the postcode itself. But whenever and whatever I try, I don't get a permanently visible marker, and the zoom level is great for mountain ranges, not so much for the individual streets I'm interested in.

asked 26 Apr '21, 17:18

AdrianHB's gravatar image

AdrianHB
11112
accept rate: 0%

Well, I can only conclude that this forum is very inactive!

I think therefore that the answer is 'no', and that the solution requires the postcode to be replaced by its lat/lon coordinates. I think I have a practical way to do this and will post it here when I've tested it.

(01 May '21, 11:52) AdrianHB
1

Similar questions within the last month:

April 24th: https://help.openstreetmap.org/questions/79846/how-to-find-the-latitude-and-longitude-of-a-city

April 13th: https://help.openstreetmap.org/questions/79638/how-do-i-get-a-list-of-coordinates

UK postcodes are particularly patchy in OSM as they are rarely signposted and there often seem to be issues with the "open" database releases.

(01 May '21, 14:51) InsertUser

This is what I did! There were 1200 postcodes not 200, but this is seemed appropriate technology for the task.

I extracted the postcodes, one to a line.

I pasted them into Chris Bell's excellent Batch Geocoder, selecting Comma-separated and Input postcode, to give output lines of the form "AB24 3TU",57.166749,-2.104203

I converted these with find-and-replace in an editor into the PHP code for an associative array and wrote a PHP script to insert map links in the format https://www.openstreetmap.org/?mlat=$lat&mlon=$lon#map=17/$lat/$lon where 17 is the zoom level and $lat and $lon are the values in the second and third CSV fields.

Obviously there are many other ways to get the same result but this worked for a one-off job of finite size.

permanent link

answered 01 May '21, 22:12

AdrianHB's gravatar image

AdrianHB
11112
accept rate: 0%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×99
×98
×55
×33

question asked: 26 Apr '21, 17:18

question was seen: 2,132 times

last updated: 01 May '21, 22:12

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum