mapzengo pokemongo unity3d pois places

MapzenGo Part 8 : Places and Pois

It has been like… just two weeks? Oh boy that felt sooo much longer, rough days…

I just realized that I have to blog now and can’t run away from it anymore. It’s soo much harder than coding really. After all these years and so many posts, I still feel horrible at blogging and incredible nervous while writing…  But anyway, I have lots of new stuff, two new layers, no wait three even; earth, places and pois, this time! New and better triangulation library, improved settings window, brand new UI visualization and lots of bug fixes. So let’s have a look;

-Let’s start small, well I added the earth layer… just because. It’s just a clone of landuse and water layers really, nothing interesting here. Admittedly I hardly even tested it. I believe it’s coming from Natural Earth api, remember Mapzen is OpenStreetMap + Natural Earth. It has some interesting features like cliff, ridge, valley but well, I’ve always been much more interested in cities so personally didn’t find it that useful.

-No worries, I have something better; places and poi (Point of interest) layers!
Places layers is like a list of populated places; cities, towns, neighbourhoods etc. It’s extremely useful for city/state/country names at low zoom levels and neighborhood names in high zoom levels.  It looks great coupled with boundary layer as well.
Poi level is even more interesting, it’s a huge list of…. interesting points… yeah. It has lots of places like Apple Store, H&M, Walgreens categorized under so many different “types”. You can check the Mapzen documentation, it’s quite detailed and explains many new properties very well.

mapzengo pois places pokemongo unity3d labelsCity and neighbourhood labels

One important thing to note here though, both these layers use the screen space UI and not the 3D world like the others. Why? Well I initially created 3D markers, like pokestops in PokemonGo but they were extremely hard to use (overlapping with each other) and understand. And you probably already know how horrible is the Unity3D  TextMesh component is. I also tried using icons on a billboard but sprites looked blurry and low quality as well. Instead I put an empty gameobject in the 3D world (as a marker) and an icon on UI which sticks to that empty gameobject on every update. It looks a lot better this way, easier to read text/icons and interact with them. If you want 3D objects though, you can still use those empty gameobject as well!

mapzen go pois place manhattan pokemongo unity3dUI elements on pois

-OK what else? Hmm hmm hmm… Ah the UV mappings!  I won’t go into too much detail with these as it’s tiny little bit complex and hard to explain but we have UVs now. Roads, landscape and water UV mapping was quite easy with repetitive textures really. Building UV mapping is a little harder and not really complete but if you’re interested, you can read our little discussion about it in this Github issue.  You can see roads, park and building UVs in the image below.

mapzen pois places uv mapping pokemongo unity3dMapzenGo with “First-result-on-google” textures

-By the way, you probably noticed how almost every screenshot has a different style right? It’s all just tweaking settings and materials, I’m not keeping any code from you guys. You can achieve all those in like 5-10 minutes of work (after you have a grasp on the general structure). For example, I got bored a few nights ago and created this PokemonGo style in a few minutes; with roads, buildings and pokemons!
That being said, I’m well aware that it’s also quite hard to switch between styles and this is I’m planning to look into soon as well and you’ll probably be able to drag&drop different styles after that.

There are probably bunch of other stuff I’m forgetting at the moment but it’s getting late, I’m getting tired so I’ll just cut it here.

mapzengo pokemongo unity3d pois placesManhattan after 50 post process image effects

What’s next? Well I want to restructure the folder hierarchy first. Not sure exactly about this one yet but I want to switch to factory/layer focused hierarchy where everything related to a single layer rests under one folder. That way it’ll be easier to plug in/out layers into any project.

Then I want a slightly different factory/settings management system. Roman’s (kind gentlemen who wrote all the settings scripts) gonna kill me , I know but I have…some ideas. Yea that sounds bad… I just want to make it easier to use, plug stuff in/out, tweak, change styles etc etc. Unfortunately I’m horrible at editor scripts so might not be able to do this for a while.

Then maybe some improvements for the UI icons of poi and places layers. Or some road mesh improvements (smoother curves? pavements?) Oh and I’m planning to drop/change the running guy thing as it takes like the 90% of the package size. And he’s not even that handsome.

Anyway so yeah, I’ll keep working on it as much as I can. Please do keep posting me… whatever. I just love hearing from you guys. That’s pretty much what keeps me going.


MapzenGo Github Page
Download MapzenGo Part 8
(v8.1 @5.10.2016, removed unnecessary image effects folder)
(v8.2 @5.10.2016, fixed BasicLoader and DynamicLoader scenes)
(v8.3 @5.10.2016, fixed some default values and settings for Poi factory)
(v8.4 @15.10.2016, Mapzen Api v1 compatibility)
(v8.5 @28.10.2016, fixed a small bug where scriptable object doesn’t run in non-windows platforms)
(v8.6 @18.12.2016, updated UniRx)






32 thoughts on “MapzenGo Part 8 : Places and Pois

  1. Hey Baran, This is awesome! I would like to use gps location to update player position and player with it~! I am struggling to figure out placing player based on (lat, lon) i get from Input.Location. Can you help translating latitude longitude into Vector3 in unity? Thanks!!!

    1. Hey there, glad you like it!
      If I recall correctly, CustomObjectPlugin does lat/long to unity3d coordinate translation, so you can check that. Let me know if it’s not clear or if you still have questions 😉

    2. I found and change a very short script that positioning the avatar related to GPS position and updates the lat/long. I’m trying to update the avatar position now related to the map, any suggestion? Can I post the code here?

      1. First of all, I’m sorry for the late response, I’m horribly busy tehse days and somehow skipped this comment 🙁
        And oh please do share it here but it would be better if you can post it on pastebin or somethnig then share the link here, just to keep comments section readable.
        I’ll try to help as much as I can as well.

  2. It’s possible add boundary from a json? JSON contains boundary polygon, containing a set of lat/long

    1. You mean you have an additional json which contains boundary polygons right? Or does Mapzen have it and I’m missing something?
      Anyway, yea that’s surely possible, and it’s no different than landscape or water factories really. You can just copy either of those and have 90% of it already.
      And I guess we really need abstract polygon/point/line factories for stuff like these.

  3. Great work dude keep on , how to implement GPS i ddn’t find a way to convert (lat,long) to X,Y

    1. Thanks man! I know lots of people are looking for GPS thing and I’ll get to that eventually but I have a few more important stuff for now. Mapzen changed their api for example! Gotta catch up with that 🙂

  4. Today I noticed old url started returning 404 error due to upgraded API I assume:
    workaround is to change _mapzenUrl to “{1}/{2}/{3}.{4}?api_key={5}”; but I don’t understood yet how to pass required layers info.

    1. Hey there!
      I’ve been horribly busy last few days so didn’t had time to look into this. I heard about api change and I’ll look into it today. Shouldn’t be too much trouble really (hopefully) and I’ll push working version this weekend.

  5. Hello !!

    Frist: Really nice work!! im working with this some weeks ago, and its amazing.

    But now i have a problem:


    404 Not Found
    Mapzen has released Vector Tiles 1.0. For more information visit:
    MapzenGo.Models.CachedDynamicTileManager:m__B(Exception) (at Assets/MapzenGo/Models/CachedDynamicTileManager.cs:57)
    UniRx.Subscribe`1:OnError(Exception) (at Assets/MapzenGo/Plugins/UniRx/Scripts/Observer.cs:172)
    UniRx.Operators.FromCoroutine:OnError(Exception) (at Assets/MapzenGo/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/FromCoroutine.cs:48)
    UniRx.c__Iterator34:MoveNext() (at Assets/MapzenGo/Plugins/UniRx/Scripts/UnityEngineBridge/ObservableWWW.cs:262)
    UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)


    Have u the same fail?

    Y hace 2 differents projects and both have the same error.

    PD: Yeah i have my API.

    1. Hey Aday, glad you like it!
      The problem is Mapzen released a new version of their api and for some reason, old api which they were supposed to keep online for a while longer, is broken at the moment.
      So yeah, I’ll have to switch to this new api. Shouldn’t be much different or difficult really, I’ll try to fix&release it this weekend.

  6. Here’s a link to Mapzen’s “cheatsheet” for converting a Unity project to the new API:

    It’s pretty much a matter of changing the URL in TileManager.cs to their new format, and changing references to the “sort_key” property to “sort_rank” in the various factories.

    @BRNKHY Awesome work by the way! Thank you for all your efforts.

    1. Hey Jeremy, thanks for that link, looks great!
      I already uploaded v8.4 and it’s supposed to fix these issues. Couldn’t test it extensively though.
      Glad you like it man! I really love working on this project but my dayjob is killing me these days so I had to slow down a bit 🙁

    1. Oh man thanks a lot!
      I’m sorry about it. I seriously did all I can to release it as soon as possible and then forgot to update the link?? Damn.
      It should be fixed now, let me know if there’s any other issues post v1 though, I’ll try to fix them as quickly as possible.

  7. Hey, one more question please, I would like to draw circular geo fence on this. Given pois and user location I was able to calculate weather user was within radius but I am not sure how to draw the circle accordingly. I placed circle under tile with scale being the radius in meter. This seems be smaller than what i get from google’s circle. Is Tile’s rectd’s scale in meters? Any clue will be appreciated. Thank man!!!

    1. If I understand that correctly, yea it should be a scaling issue. You’re placing that circle under world object right? have you checked it’s transform scale? It should be Hmmm what else…. ar eyou trying this with a custom mesh or sphere? Sphere would be better for testing. And yea that’s all I can think of at the moment 🙁
      let me know if that doesn’t work 😉

  8. I’ve tried to upgrade to v1 by myself and i have a problem with factories when Merge Meshes = false. For example, in RoadFactory neither
    road.SortKey = (int)geo[“properties”][“sort_rank”].f;
    road.SortKey = (int)geo[“properties”][“sort_key”].f;
    are working.
    I’ve changed _mapzenUrl in TileManager.
    Any ideas?

    1. Hey there!
      Yea I just realized that as well, switching to rank just won’t cut it. You can remove that ine for now as it’s not used for anything anywhere really. I’ll properly fix that later on.

  9. Hello,
    After cloning the repo and opening the project in Unity 5.4.1 on Mac ( El Capitan) I get the following script compilation error:
    Assets/MapzenGo/Helpers/Search/Editor/SearchPlaceEditor.cs(29,51): error CS0117: `MapzenGo.Models.Settings.Editor.HelperExtention’ does not contain a definition for `GetOrCreateSObjectReturn’

      1. The problem raised by Joakim on El Capitan is because HelperExtention.cs defines GetOrCreateSObject within a windows-only block, so the function won’t exist on Mac (where UNITY_EDITOR_WIN is false). The #if protection can be removed as far as I can see – not sure why it’s there, and the code seems to work fine on a mac, although I’ve not looked incredibly closely.

        I also noted that in the default scene, the properties for the BuildingFactory and the RoadFactory were not connected – simple to select those from the project Assets.

        And finally (as far as I looked so far), the sort_key isn’t present in the properties (as pointed out by the user above), which I guess is a change from the new mapzen API. Applying the suggested workaround (just deleting link 211 in BuildingFactory.cs), this all works for me on a mac.

        1. Hey there!
          I noticed that ifdef as well and removed it on git. If I recall correctly, most recent package above also has that removed.
          I tend to look over other scenes as I’m always working on CachedDynamicLoader scene. Lots of people having lots of issues with those as well, gotta fix that as soon as possible.
          sort_key is replaced by sort_rank I believe. I also removed it but I guess I haven’t pushed that yet. So much stuff going on these days (@work) so couldn’t find any time to fix even these small bugs >< Thanks man!

  10. Hey Baran; what version of Unity are you using? The 5.5.0b4 beta breaks this for me when it upgrades the scripts.

    1. Hey Petrov!
      I think I’m using 5.4.something, haven’t tested it with 5.5. What kind of an error are you getting?

  11. In Plugins/UniRx/Scripts/UnityEngineBridge/MainThreadDispatcher, line 312: “Static member ‘UniRx.MainThreadDispatcher.StartCoroutine(System.Collections.IEnumerator)’ cannot be accessed with an instance reference.” I tried changing it but I must have done it wrong because Unity crashes when I try to run the sample.

    Thanks! I know you’re super busy.

    1. Hey Petrov!
      Sorry for the late response. I think it’s a problem with UniRx observable calls. Can you check the call stack and find where that comes from? (to MainThreadDispatcher line 312)

      1. Hey Baran and Pretov!

        I fixed this issue like this:

        (dispacher2 as MonoBehaviour).StartCoroutine(routine);

        And it is the same bug fix for the second one 🙂

        Thank you for your awesome job Baran !

Leave a Reply