Customisation, Laravel and website map

Over the weekend and at the start of this week, I’ve been doing some customisation work for users of WP Google Maps, as an authorised 3rd party developer. Code Cabin have been kind enough to pass me customisation jobs which they don’t have the capacity for, whilst I am having some time off to train (specifically in Laravel and Symfony), it’s very helpful for me to have a few odd jobs to do.

Customisation job for a WP Google Maps user

I’ve made a breakthrough with Laravel and will be doing a sprint on my REST cache plugin this week, which will be the fruition of my learning exercise with Laravel in the context of a WordPress plugin. I’ll make a page for the plugin and post more information soon, as well as starting to update the repo as one would in a shared project, just as soon as I’ve finished prototyping. I’m currently still bouncing ideas around and changing the code a lot, I need to double check that this setup is going to work on shared hosting, and from there I can establish that using Laravel is feasible and continue on with that. There’s not actually very much documentation on using Laravel in this context, so there are challenges to overcome here, however I welcome this and have been spending some time looking at stack traces and going through Laravel’s code to establish what I’m doing wrong – in a couple of instances, this has been more helpful than actually looking for documentation. I’m quite used to this process in the context of API’s and WordPress in particular.

My first Laravel API route, working in the context of a WordPress plugin

I’ve compiled a list of some of the websites I’ve worked on in the last couple of years, it’s by no means complete, however it’s a bit too long for display in list format. I decided that a good way to represent these sites would be on a map, using the mapping software I was formally in charge of, and so I set about using Composer to install Guzzle and GeoIP2 PHP geocoder.

A map of some of the websites I have worked on

Equipped with a list of domains I’ve worked on, and the MaxMind GeoIP2 City free database, I made a small command line tool to find the IP for each domain, then use the geocoder to turn that into a rough latitude and longitude. Obviously, this isn’t perfect, and I did look at actually scraping this from site metadata, however in the small sample of sites I tried this on manually, I didn’t find many sites that offer that data in an easily interpretable manner. For the purposes of this display, IP to coordinates at a city level is perfectly suffice.

You can explore the map on this page.

I like to spend a couple of hours each weekend doing projects for my own amusement and for my health as a programmer, so I spent some time working on “zoom to cursor” code for an orthographic 2D camera in THREE.js, although this code could be applied more broadly. I’ve got a working algorithm which I’ve run numbers through, however my attempts to integrate this code into Yomoto’s Camera Controls has been, so far, unsuccessful. To be fair, I’m not really experienced with TypeScript, and I’m unfamiliar with the way this particular cameras API has been written, this is something I’d really like to improve on in the future, however as this is “just for fun” I haven’t spent too much time on this. I’ve left a comment on Yomoto’s GitHub repository asking if my code can be integrated, hopefully he’ll respond soon. I did also try to do this by disabling mousewheel zooming on his module, and then handling this myself, however Yomoto’s camera and my external code didn’t work well together. I’m sure I can do this using THREE.js’s standard orthographic camera (and have done in the past), but I’d really like to keep the enhanced feature set of Yomoto’s camera.

Hopefully I should have more on that after this weekend!

1 thought on “Customisation, Laravel and website map

Leave a Reply