{"action":"created","issue":{"url":"https://api.github.com/repos/Logicify/jquery-locationpicker-plugin/issues/45","labels_url":"https://api.github.com/repos/Logicify/jquery-locationpicker-plugin/issues/45/labels{/name}","comments_url":"https://api.github.com/repos/Logicify/jquery-locationpicker-plugin/issues/45/comments","events_url":"https://api.github.com/repos/Logicify/jquery-locationpicker-plugin/issues/45/events","html_url":"https://github.com/Logicify/jquery-locationpicker-plugin/issues/45","id":102117407,"number":45,"title":"Any other address component example to get correct street component?","user":{"login":"azulkipli","id":8231792,"avatar_url":"https://avatars.githubusercontent.com/u/8231792?v=3","gravatar_id":"","url":"https://api.github.com/users/azulkipli","html_url":"https://github.com/azulkipli","followers_url":"https://api.github.com/users/azulkipli/followers","following_url":"https://api.github.com/users/azulkipli/following{/other_user}","gists_url":"https://api.github.com/users/azulkipli/gists{/gist_id}","starred_url":"https://api.github.com/users/azulkipli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azulkipli/subscriptions","organizations_url":"https://api.github.com/users/azulkipli/orgs","repos_url":"https://api.github.com/users/azulkipli/repos","events_url":"https://api.github.com/users/azulkipli/events{/privacy}","received_events_url":"https://api.github.com/users/azulkipli/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-08-20T11:17:23Z","updated_at":"2015-09-24T01:16:53Z","closed_at":null,"body":"in my case i got this address when dragging marker to other coordinate\r\n\r\nJalan Jakarta No.21, Batununggal, Kota Bandung, Jawa Barat 40271, Indonesia\r\n\r\nmy code\r\n\r\n```\r\n$('#location_picker').locationpicker({\r\n    location: {latitude: -6.8959712, longitude: 107.6309693},\r\n    locationName: \"\",\r\n    radius: null,\r\n    zoom: 15,\r\n    scrollwheel: true,\r\n    inputBinding: {\r\n        latitudeInput: $('#latitude'),\r\n        longitudeInput: $('#longitude'),\r\n        radiusInput: null,\r\n        locationNameInput: $('#address')\r\n    },\r\n    enableAutocomplete: false,\r\n    enableReverseGeocode: true,\r\n});\r\n```\r\n\r\nif  i use this code as in example\r\n```\r\nfunction updateControls(addressComponents) {\r\n    $('#address').val(addressComponents.addressLine1);\r\n    $('#city').val(addressComponents.city);\r\n    $('#province').val(addressComponents.stateOrProvince);\r\n    $('#zipcode').val(addressComponents.postalCode);\r\n    $('#country_id').val(addressComponents.country);\r\n}\r\n\r\n$('#location_picker').locationpicker({\r\n    location: {latitude: -6.8959712, longitude: 107.6309693},\r\n    radius: null,\r\n    zoom: 15,\r\n    enableAutocomplete: true,\r\n    enableReverseGeocode: true,\r\n    onchanged: function (currentLocation, radius, isMarkerDropped) {\r\n        var addressComponents = $(this).locationpicker('map').location.addressComponents;\r\n        updateControls(addressComponents);\r\n    },\r\n    oninitialized: function(component) {\r\n        var addressComponents = $(component).locationpicker('map').location.addressComponents;\r\n        updateControls(addressComponents);\r\n    }\r\n});\r\n```\r\n\r\nI got \"21 Jl. Jakarta\" for street component, \r\nIn my country the correct format for street address is \"Jalan Jakarta No.21\"\r\n\r\nhow can i get correct street address format?\r\n\r\nthank you\r\n"},"comment":{"url":"https://api.github.com/repos/Logicify/jquery-locationpicker-plugin/issues/comments/142775599","html_url":"https://github.com/Logicify/jquery-locationpicker-plugin/issues/45#issuecomment-142775599","issue_url":"https://api.github.com/repos/Logicify/jquery-locationpicker-plugin/issues/45","id":142775599,"user":{"login":"azulkipli","id":8231792,"avatar_url":"https://avatars.githubusercontent.com/u/8231792?v=3","gravatar_id":"","url":"https://api.github.com/users/azulkipli","html_url":"https://github.com/azulkipli","followers_url":"https://api.github.com/users/azulkipli/followers","following_url":"https://api.github.com/users/azulkipli/following{/other_user}","gists_url":"https://api.github.com/users/azulkipli/gists{/gist_id}","starred_url":"https://api.github.com/users/azulkipli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azulkipli/subscriptions","organizations_url":"https://api.github.com/users/azulkipli/orgs","repos_url":"https://api.github.com/users/azulkipli/repos","events_url":"https://api.github.com/users/azulkipli/events{/privacy}","received_events_url":"https://api.github.com/users/azulkipli/received_events","type":"User","site_admin":false},"created_at":"2015-09-24T01:16:53Z","updated_at":"2015-09-24T01:16:53Z","body":"Yes thank you I was thinking the splitting solution for localized formatted\naddress but dont know how to do it yet, now you point me how to do it..I\nthink this is feasible solution, we can split other address part too from\nthis case.\n\nThank you\n\nOn Thu, Sep 24, 2015 at 2:11 AM, Marc Mültin <notifications@github.com>\nwrote:\n\n> Ah, all right, now I got it. I cannot access this formatted_address\n> attribute from your example code, I would have to modify your javascript\n> code.\n>\n> My suggestion:\n> 1. In setPosition replace\n>\n> GmUtility.address_component_from_google_geocode(results[0].address_components);\n>\n> with\n>\n> GmUtility.address_component_from_google_geocode(results[0].address_components,\n> results[0].formatted_address);\n>\n>    1.\n>\n>    In the line which starts with\n>    address_component_from_google_geocode: function(address_components) {\n>    add a 'formattedAddress' parameter (according to step 1)\n>    2.\n>\n>    Further down the code lines do the following:\n>    //result.addressLine1 = [result.streetNumber,\n>    result.streetName].join(' ').trim(); <- the old original code\n>    addressParts = formatted_address.split(', ') // <- new code\n>    result.addressLine1 = addressParts[0] // <- new code\n>\n> So the addresLine1 is always in a local format. Am I missing sth. or would\n> this be a feasible solution?\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/Logicify/jquery-locationpicker-plugin/issues/45#issuecomment-142700781>\n> .\n>\n"}}