Traccar and Nominatim.

Anton Tananaev7 years ago

I already answered that question. I am using different URL. Everything else is obviously the same.

vdovin7 years ago

Maybe there are other solutions... For example i try to start my traccar from IDEA and try to connect to server through mobile by address something like 192.168.1.2:8082?? And if i correctly understood when server get my lat and lon , it make request to geocoder server. So I try to debug this moment, so maybe i will see some problem with URL or parsing. There are something right in my words??

Anton Tananaev7 years ago

That makes sense. Debugging it should help.

vdovin7 years ago

But i don't how i can do next thing. I have idea with traccar at first computer. But my traccar server and nominatim at another one. So how i can connect my mobile to server in one network. Maybe something like 192.168.1.6:8082????

Anton Tananaev7 years ago

Something like that. Note that if you are talking about Traccar Client, then the port should be 5055.

vdovin7 years ago

I put in debug.xml necessary settings.But i don't know where i should put break point:) So I put it in JsonReverseGeocoder


 Context.getAsyncHttpClient().prepareGet(String.format(url, latitude, longitude))
                .execute(new AsyncCompletionHandler() {
            @Override
            public Object onCompleted(Response response) throws Exception {
                try (JsonReader reader = Json.createReader(response.getResponseBodyAsStream())) {
                    Address address = parseAddress(reader.readObject());
                    if (address != null) {
                        String formattedAddress = format.format(address);
                        if (cache != null) {
                            cache.put(new AbstractMap.SimpleImmutableEntry<>(latitude, longitude), formattedAddress);
                        }
                        callback.onResult(formattedAddress);
                    } else {
                        callback.onResult(null);
                    }
                }
                return null;
            }

at this line

            Address address = parseAddress(reader.readObject());

and also i put breakpoint in NominatimReverseGeocoder. But I don't go to this breakpoint after parseAddress from JsonReverseGeocoder. In my config properties I have nominatim and my external ip...

debug
vdovin7 years ago

http://joxi.ru/5mddzn4Fkqv5dm

So there is one problem which put me in a deadlock. I can't connect to my external my ip if I'm in same network...

Anton Tananaev7 years ago

Probably because parsing JSON fails. You should look at the response content.

vdovin7 years ago

I put breakpoint at all geocoder classes where is implemented parseAddress...But when try to continue debug from
this line
Address address = parseAddress(reader.readObject());
I couldn't stopped at one of this geocoder....
So i get next error javax.json.stream.JsonParsingException: Unexpected char 60 at (line no=1, column no=1, offset=0)

Anton Tananaev7 years ago

You have to check what's coming from the geocoder. Obviously it won't get into "parseAddress" method if JSON is invalid and it fails before that.

vdovin7 years ago

http://joxi.ru/D2PKeyJSpwdzem
It's all that i have

Anton Tananaev7 years ago

You should probably find a way to display it in a human readable text format.

vdovin7 years ago

It's not possible. As result i have byte array.So i don't know protocol which define it

Anton Tananaev7 years ago

Everything is possible. You can either modify the code or use "evaluate expression" feature in IDEA.

vdovin7 years ago

So i use evaluate expression, you can see it at screen.But i have something like
0 = 60
1 = 104
2 = 116
....
With length 691. So when i try to readObject from reader i got an error that i sent you