multiple pins in a map from webservice

You must Login before you can answer or comment on any questions.

Hi guys,

I am fairly new to Titanium and i am having a lot of fun developing in the IDE and running all the emulators with various test applications.

But now i am starting a little project which i want to get in the app store and in the google play store. So i am trying my best to use all the standard functions from the Appcelerator sdk.

So the first issue that i have is using the forwardGeocoder() function. This does not work outside the US (at least that is what i think of it). And that sucks! If you guys don't want to fix this function please mark it as deprecated and offer another solution.

I have read a lot about using the google maps api but i cant seem to create a function that i can use to generate a map with multiple pins.

My data source is a webservice that i created myself and i can get addresses from it (street, number, zip, city/town, country) in json format.

{
    "tests": [
        {
            "Test": {
                "test_id": "1",
                "test_name": "Test Vet v2",
                "test_comment": "Test Vet",
                "test_street": "Test Vet",
                "test_number": "2",
                "test_zip": "1234ab",
                "test_city": "Test Vet",
                "test_phone": "1234567890",
                "test_email": "test@test.nl",
                "test_url": "www.Test.nl",
            }
        }
    ]
}
So i was wondering, and please keep in mind that i want to learn so no block of code that does what i want, how should i do this? And i am not only talking about the google maps api but also getting it to work in ios and android.

Thanks in advance!

(my javascript experience is medium, but i have alot of php experience)

2 Answers

You can use the Google maps api (https://developers.google.com/maps/), but you MUST have a key to use it or the Google Store and the Apple store will not approve your app. With the Google maps api pass your latitude and longitude to the api, this will then return your annotation data that you want in your pin. But (there is a catch) you are limited to the number of FREE request you can make to the google api. If you exceed the max value of request google will charge you.

As a side note If you do not have a starting latitude and longitude to throw at the api use the devices current location, that will contains the lat/lng. Also in your app.js write a method that will check to see if the device is online before your app runs and handle that gracefully. I didn't hit you will a lot of code blocks cuz you wanna learn this, but the notes here should give you some direction on what to search for.

The answer from Chris was not my solution but got me thinking.

So i added two fields to my webservice for lat and lng. now i can retrieve these using the json function and simply add these to the map.

Now i can save up on requests to gmaps because i save them in my webservice (so there is only one request per save) and all the data is in my own database.

Your Answer

This question has been locked and cannot accept new answers.