Hi,
Can anyone give some notes?
Xuemei
On Apr 5, 12:30 am, Xuemei Liu <
lxuemei3...@gmail.com> wrote:
> Hi, Victor, Pavol,
>
> Thanks for your advice and help, I made much progress.
> At present I decided not to modify the .obf file, but just load our .patch
> file for update. As map data will be only used in rendering and navigation,
> so I modify methods MapRenderRepositories.java.loadVectorData and
> BinaryRoutePlanner.java.loadRoutes. I add code in the two methods to load
> roads from our patch file after loading map from obf files. I encode
> coordinates of added roads from lon&lat to x&y
> using MapUtils.get31TileNumberY() and MapUtils.get31TileNumberX(). *Is this
> encoding method right? *If no, what should it be? If yes, I have the
> following problem.
> *The added roads appear after rendering, but cannot used for navigation*.
> Then I spent the whole night to debug the code, and find the following
> problem of inconsistent between coordinates written to obf file and those
> read from obf file, which makes the navigation not work.
>
> Code that related to the problem:
> 1. Generate obf file from osm file.
> In
> net.osmand.data.preparation.IndexVectorMapCreator.java.insertBinaryMapRende rObjectIndex(),
> MapUtils.get31TileNumberY
> and MapUtils.get31TileNumberX are used to convert from lon&lat to x&y, and
> write x&y to binary file.
> 2. Read map data from obf file.
> In net.osmand.binary.BinaryMapIndexReader.readMapDataObject(),
> "(codedIS.readSInt32() << SHIFT_COORDINATES) + px" and
> "(codedIS.readSInt32() << SHIFT_COORDINATES) + py" are used to read binary
> bits to x&y coordinates. *Why not just direct read x&y, but have such
> complex convention? Did I miss anything?*
> Example of the problem (the example is got by tracking coordinates in one
> road):
> 1. lat='37.4210738' lon='-122.1330728' ==> x='34518966' y='832711323',
> and x & y are written to obf file.
> 2. after reading the obf, x='34518964' y='832711296', not as expected.
>
> Can you tell me why? I need to know it then my added roads can be used for
> navigation.
>
> Xuemei
>
>
>
>
>
>
>
> On Mon, Apr 2, 2012 at 5:21 PM, Xuemei Liu <
lxuemei3...@gmail.com> wrote:
> > ok, i will consider that. Thanks for the advice.
>
> > On Mon, Apr 2, 2012 at 3:45 PM, Pavol Zibrita <
pavol.zibr...@gmail.com>wrote:
>
> >> Hi!
>
> >> You should probably think about some other format for storing, for
> >> example sqlitedb, and providing ResourceManager a new implementation how to
> >> get offline data
> >> for particular region, and so you would have some updateable offline
> >> resource, not very compact, but useful for inserting/retrieveing. For sure,
> >> it would than be nice to handle its size and somehow..
> >> I don't know, if it is too huge to convert it to obf or whatever.
>
> >> Just a though how it can be done also other way.
>
> >> Best regards,
> >> Pavol
>
> >> On Mon, Apr 2, 2012 at 11:23 PM, Xuemei Liu <
lxuemei3...@gmail.com>wrote:
>
> >>> Then can you tell me or give me some document of how the .obf file
> >>> is organized? I am not clear yet. I just saw you use Protobuf to read the
> >>> data in the obf file, and thought it might be related to it.
>
> >>> Xuemei
>
> >>> On Mon, Apr 2, 2012 at 1:57 PM, Victor Shcherb <
victor.shch...@gmail.com
> >>> > wrote:
>
> >>>> The problem not in Protobuf! The problem is file structure. There are
> >>>> cross references between messages (simple byte shifts) and length part of
> >>>> messages. So if you try update one message, you will need to update the
> >>>> length of that message, the length of map block, the lenght of map index
> >>>> and so on. I'm not sure it will be easy.
>
> >>>> Victor
>
> >>>> 2012/4/2 Xuemei Liu <
lxuemei3...@gmail.com>
>
> >>>>> Hi, Victor and Pavol,
> >>>>> Thanks for your response. I will read material about Google Protocol
> >>>>> Buffers first, try to understand it, then consider feasible solution.
>
> >>>>> Xuemei
>
> >>>>> On Mon, Apr 2, 2012 at 9:15 AM, Victor Shcherb <
> >>>>>
victor.shch...@gmail.com> wrote:
>
> >>>>>> To be honest i'm wondering how it can be implemented. The maps were
> >>>>>> designed to be read-only on the device! If you want to modify them before,
> >>>>>> modify the Osmand file. I think you will find a lot of problems supporting
> >>>>>> cross references in the file
> >>>>>> On Apr 2, 2012 10:35 AM, "Pavol Zibrita" <
pavol.zibr...@gmail.com>
> >>>>>> wrote:
>
> >>>>>>> Hi!
>
> >>>>>>> Probably the
> >>>>>>> IndexVectorMapCreator#insertBinaryMapRenderObjectIndex method? Well, I'm
> >>>>>>> helping with developing, but I also don't know each inch of the code :-/.
> >>>>>>> Most helpful would be Victor,
> >>>>>>> but I think he is quite busy.
>
> >>>>>>> Best regards,
> >>>>>>> Pavol
>
> >>>>>>> On Mon, Apr 2, 2012 at 8:27 AM, Xuemei Liu <
lxuemei3...@gmail.com>wrote:
>
> >>>>>>>> In fact I have spent long time on reading and debugging the code,
> >>>>>>>> but still have the previous problems and give out the questions. I just
> >>>>>>>> think you are the developers of Osmand, some of you may be familiar with
> >>>>>>>> what I asked, and can give some notes to me. Of course I will keep
> >>>>>>>> debugging and reading the code. Thanks
>
> >>>>>>>> Xuemei
>
> >>>>>>>> On Sun, Apr 1, 2012 at 11:13 PM, andre van atten <
> >>>>>>>>
andrevanat...@gmail.com> wrote:
>
> >>>>>>>>> Hi Xuemei,
>
> >>>>>>>>> ad 2. No, Sorry, I can't. I would have to search for a long time.
> >>>>>>>>> ad 3. That's right. Then you have to wait until the coders
> >>>>>>>>> themself have time for you to sort it out. Their time is very sparse too;-)
>
> >>>>>>>>> Andre
>
> >>>>>>>>> Op 2 april 2012 07:55 schreef Xuemei Liu <
lxuemei3...@gmail.com>het volgende:
>
> >>>>>>>>> 1. The code of MapCreater is IndexVectorMapCreator.java
> >>>>>>>>>> 2. Can you tell me the exact function (or class) which is used
> >>>>>>>>>> to show the map when the "Map" big button is clicked in the menu.
> >>>>>>>>>> 3. The upper question is not solved yet...
>
> >>>>>>>>>> Xuemei
>
> >>>>>>>>>> On Sun, Apr 1, 2012 at 10:37 PM, andre van atten <
> >>>>>>>>>>
andrevanat...@gmail.com> wrote:
>
> >>>>>>>>>>> The code for showing the map is obviously in the osmand Android
> >>>>>>>>>>> app itself, and no code is provided in the MapCreator.
>
> >>>>>>>>>>> Andre
> >>>>>>>>>>> Op 2 apr. 2012 03:47 schreef "Xuemei Liu" <
lxuemei3...@gmail.com>
> >>>>>>>>>>>>> 2012/3/30 Xuemei Liu <
lxuemei3...@gmail.com>
>
> >>>>>>>>>>>>>> We do map update calculation on the server side, and I think
> >>>>>>>>>>>>>> we will based on .osm map (We want to modify the osm map file automatically
> >>>>>>>>>>>>>> so that the update can be submitted to OSM server directly). Then, we will
> >>>>>>>>>>>>>> send the update back to Osmand user to update their .obf map. I just have
> >>>>>>>>>>>>>> some experience of using R-trees, and I think it will be a tough work to
> >>>>>>>>>>>>>> modify the obf file according to your introduce. Another scheme is just
> >>>>>>>>>>>>>> adding a patch file (update.pat) for the obf file (original map) to store
> >>>>>>>>>>>>>> the map update. As we calculate the map update on the server side based on
> >>>>>>>>>>>>>> the osm file, we need to know the correlation between the road IDs in osm
> >>>>>>>>>>>>>> file and those in obf file, e.g., we add a new road 000 to connect road 111
> >>>>>>>>>>>>>> and road 222 in osm file (some intersection points will be added in osm
> >>>>>>>>>>>>>> file, and road 111 and 222 will be modified as well ), the new update will
> >>>>>>>>>>>>>> be sent to Osmand user and store in the update.pat file, and we need to
> >>>>>>>>>>>>>> know the IDs of road 111 and 222 in obf file to modify them, and add the
> >>>>>>>>>>>>>> new road into the Rtree as well. So in this scheme, I need to know the
> >>>>>>>>>>>>>> correlation. Can anyone give some advice of how to implement this? I will
> >>>>>>>>>>>>>> start by reading the IndexCreator<
http://code.google.com/p/osmand/source/browse/DataExtractionOSM/src/n...>
> >>>>>>>>>>>>>> code.
>
> >>>>>>>>>>>>>> Thanks,
> >>>>>>>>>>>>>> Xuemei
>
> >>>>>>>>>>>>>> On Fri, Mar 30, 2012 at 12:26 AM, Pavol Zibrita <
> >>>>>>>>>>>>>>
pavol.zibr...@gmail.com> wrote:
>
> >>>>>>>>>>>>>>> Hi!
>
> ...
>
> read more »