Skip to content

Instantly share code, notes, and snippets.

@thany
Last active May 22, 2025 11:43
Show Gist options
  • Save thany/a21281f2d9847d1c94c8c9d8a2447968 to your computer and use it in GitHub Desktop.
Save thany/a21281f2d9847d1c94c8c9d8a2447968 to your computer and use it in GitHub Desktop.
Get Denso Mapcode from Denso server using a bash command
wget http://post.denso-communications.jp/dn/navicon_start.php --method=POST --body-data="lat=35.872722875676274&lng=139.73869658316153" -O - -q | grep -Po '(?<=id="mapcode">)([^<]*)'
@bespired
Copy link

bespired commented May 8, 2025

Well, if anyone is interested. I've scraped the zones from saibara.sakura.ne.jp/map/convgeo.cgi
google drive: denso-mapcode-zones.js
As it turns out they are a bit off... Looking into that.
I'm going to check them on mapion, but random checks show it looks okay.
Next is figure out the Block/Unit/S-core

denso-mapcode-zones

@thany
Copy link
Author

thany commented May 9, 2025

I'm seeing a lot of overlaps. I wonder how those are handled. Maybe it's just simply the lower zone number get prioritised.

Also, kudos for visualising the zones on a map. Definitely a useful way to ensure/verify everything is covered.

@bespired
Copy link

bespired commented May 9, 2025

We are getting there... πŸ˜„
Still not seeing how the overlap actually matters.. Some places even have 3 overlapping zones.
All these mapcodes seem to point to the same lat/lon when reverse searching.
The code I have now picks the highest number by accident because the code is not very smart yet.
Still trying to figure out how it actually works.
I did find I scrapped the zones to tight. They should be 9m bigger...

Good to see in overlapping zones:

55-error

For putting the mapcode in a car navi these differences don't really matter I think.
And I don't know if a car navi in Japan is okay with wrong zones.
But yeah,... needs to be fixed just to be more neat.
More later.

I think I will create a client-side (Vite-Vue3-Leafjs-OpenStreetMap) solution.
And I don't know if Denso is going to be happy with their "secret" zone data on the clients browser.

@bespired
Copy link

I've made a story on medium about my adventures with mapcode:
https://bespired.medium.com/adventures-in-denso-japan-mapcode-6743694d26a8
with a repo in github https://github.com/bespired/mapcode

@thany
Copy link
Author

thany commented May 21, 2025

Very cool! There are a few typos, but that's okay. Maybe extend the article to answer the seemingly important questions in the comment. But other than that I think your contribution is going to be really helpful 😎 I really respect how you allowed yourself to "bite" into this issue and not let go until you found a suitable solution πŸ‘πŸ»

@bespired
Copy link

Thanks Martijn.
Still need to check if any random coordinate actually gives the correct answer.
But I found something I don't really understand yet.
Apparently the Longitude/Latitude of Japan are not the same as the Longitude/Latitude of the world (???)

Screenshot 2025-05-22 at 13 30 38

So putting global lon/lat into Mapion doesn't actually works. Because they are not the same as the Japanese lat/lon... I don't know, I find this very confusing.

Screenshot 2025-05-22 at 13 35 19

Apparently Japan has earthquake shifted lat/lon?
https://www.fig.net/resources/proceedings/fig_proceedings/fig_2002/Ts5-5/TS5_5_ishihara.pdf

This is all far beyond my comprehension. Pretty nuts if you ask me...
And way beyond my initial wish to just have a Japan Mapcode from under my cursor.

Screenshot 2025-05-22 at 13 40 53

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment