GOGGS Posted July 25, 2025 Report Share Posted July 25, 2025 Even though I frequently bulk update my placelevel field for places with queries, I wanted to make this more automatic. I input my places with the format "Address, Location, Town, County, State, Country" so that drilling down in the placesearch pages works slick. So if you follow this "style", and place entry with no comma characters is a Country, e.g. USA, which is placelevel 6 is you're following the standard assignment. SC, USA or South Carolina, USA has 1 comma, and is a State, and so on. So if you count the commas in a place entry and subtract from 6, you get the placelevel (unless there are exceptions where addresses/places may have other commas. There are a lot of admin_ php files that update the tng_places table, and I've added this algorithm to them, along with a formula for zoom. It's a lot for creating a mod, IMHO, but I also changed the geocode function to add placelevel (i.e. when that is used to bulk update places). Here's the code I used for those that are interested, and if enough find it useful, then maybe we created a published mod? // These lines are added prior to a INSERT INTO $places_table query... $placelevel = 6 - substr_count($place, ","); // State = placelevel 5 $zoom = 22 - (3 * $placelev); // Country = zoom 4, State = zoom 7, etc. Cheers GOGGS Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.