This object is in archive! 

Getting error when using my own .map file

Nick Pietrosanti shared this problem 10 years ago
Not a Problem

I have created a .map file and when I put it in the location /mnt/sdcard/Locus/mapsVector i am getting and error:


Problem with File `mymap.map`!


FileOpenResult [success=false, errorMessage=invalid magic byte: # Map file created f]


I have tried a map that I downloaded from locusvectormaps "new_york.osm.map" and this .map file does work.


Any ideas?

Replies (46)

photo
0

hi nick


can you load your map with an other app?


eg


https://code.google.com/p/mapsforge/d...

photo
0

I can try. Let me try.

photo
0

I tried to load with the app "AdvancedMapViewer" and this is what I get:


Error:


The selected file is invalid.


invalid magic byte: # Map file created f


Any ideas?

photo
0

Hey gynta,


If I have a the map I want in a .shp file or .eml file can I convert that to a .map file to use with locus?

photo
0

i meant to say .kml not .eml.

photo
0

check this method ... http://docs.locusmap.eu/doku.php/manu...


should help

photo
0

Thanks. I am having some trouble

photo
0

This is the point I am at right now. I used merkaartor and opened the .shp file I want to convert and I exported it to test.osm.


Now I am a little lost.


I need to do something like the following right:


osmosis.bat --read-xml test.osm --mapfile-writer file=test.osm.map

photo
0

I am getting errors all over:


C:Program Files (x86)osmosisbin>osmosis.bat --read-xml file=test.osm --mapfil


e-writer file=test.osm.map


Jun 17, 2013 11:56:08 AM org.openstreetmap.osmosis.core.Osmosis run


INFO: Osmosis Version 0.41


Jun 17, 2013 11:56:08 AM org.openstreetmap.osmosis.core.Osmosis run


INFO: Preparing pipeline.


Jun 17, 2013 11:56:08 AM org.mapsforge.map.writer.osmosis.MapFileWriterTask


INFO: mapfile-writer version: mapsforge-map-writer-0.3.0


Jun 17, 2013 11:56:08 AM org.mapsforge.map.writer.osmosis.MapFileWriterTask


INFO: mapfile format specification version: 3


Jun 17, 2013 11:56:08 AM org.openstreetmap.osmosis.core.Osmosis run


INFO: Launching pipeline execution.


Jun 17, 2013 11:56:08 AM org.openstreetmap.osmosis.core.Osmosis run


INFO: Pipeline executing, waiting for completion.


Jun 17, 2013 11:56:08 AM org.openstreetmap.osmosis.core.pipeline.common.ActiveTa


skManager waitForCompletion


SEVERE: Thread for task 1-read-xml failed


java.lang.AbstractMethodError: org.mapsforge.map.writer.osmosis.MapFileWriterTas


k.initialize(Ljava/util/Map;)V


at org.openstreetmap.osmosis.xml.v0_6.XmlReader.run(XmlReader.java:95)


at java.lang.Thread.run(Unknown Source)


Jun 17, 2013 11:56:08 AM org.openstreetmap.osmosis.core.Osmosis main


SEVERE: Execution aborted.


org.openstreetmap.osmosis.core.OsmosisRuntimeException: One or more tasks failed


.


at org.openstreetmap.osmosis.core.pipeline.common.Pipeline.waitForComple


tion(Pipeline.java:146)


at org.openstreetmap.osmosis.core.Osmosis.run(Osmosis.java:92)


at org.openstreetmap.osmosis.core.Osmosis.main(Osmosis.java:37)


at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)


at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)


at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)


at java.lang.reflect.Method.invoke(Unknown Source)


at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Laun


cher.java:329)


at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav


a:239)


at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La


uncher.java:409)


at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:


352)


at org.codehaus.classworlds.Launcher.main(Launcher.java:47)

photo
0

Any ideas?

photo
0

I think I had the same error. I lost my solution now, but I believe it was occurring because an input file was not compatible with the parameter. I think it was just a matter of changing the parameter to the right one.

photo
0

did you need to reference an xml file at all when issuing the osmosis cmd?

photo
0

When I try and follow the method in:


http://docs.locusmap.eu/doku.php/manu...


I am getting the following:


osmosis.bat --read-xml test.osm --mapfile-wri


ter file=test.osm.map type=ram tag-conf-file=tag-mapping-shp.xml bbox-enlargemen


t=0


Jun 18, 2013 10:36:27 AM org.openstreetmap.osmosis.core.Osmosis run


INFO: Osmosis Version 0.41


Jun 18, 2013 10:36:27 AM org.openstreetmap.osmosis.core.Osmosis run


INFO: Preparing pipeline.


[Fatal Error] :2:6: The processing instruction target matching "[xX][mM][lL]" is


not allowed.


Jun 18, 2013 10:36:27 AM org.mapsforge.map.writer.OSMTagMapping


SEVERE:


** Parsing error, line 2, uri null


Jun 18, 2013 10:36:27 AM org.openstreetmap.osmosis.core.Osmosis main


SEVERE: Execution aborted.


java.lang.IllegalStateException: org.xml.sax.SAXParseException; lineNumber: 2; c


olumnNumber: 6; The processing instruction target matching "[xX][mM][lL]" is not


allowed.


at org.mapsforge.map.writer.OSMTagMapping.(OSMTagMapping.java:280)


at org.mapsforge.map.writer.OSMTagMapping.getInstance(OSMTagMapping.java


:111)


at org.mapsforge.map.writer.model.MapWriterConfiguration.loadTagMappingF


ile(MapWriterConfiguration.java:389)


at org.mapsforge.map.writer.osmosis.MapFileWriterFactory.createTaskManag


erImpl(MapFileWriterFactory.java:54)


at org.openstreetmap.osmosis.core.pipeline.common.TaskManagerFactory.cre


ateTaskManager(TaskManagerFactory.java:60)


at org.openstreetmap.osmosis.core.pipeline.common.Pipeline.buildTasks(Pi


peline.java:50)


at org.openstreetmap.osmosis.core.pipeline.common.Pipeline.prepare(Pipel


ine.java:112)


at org.openstreetmap.osmosis.core.Osmosis.run(Osmosis.java:86)


at org.openstreetmap.osmosis.core.Osmosis.main(Osmosis.java:37)


at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)


at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)


at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)


at java.lang.reflect.Method.invoke(Unknown Source)


at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Laun


cher.java:329)


at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav


a:239)


at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La


uncher.java:409)


at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:


352)


at org.codehaus.classworlds.Launcher.main(Launcher.java:47)


Caused by: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 6; The pr


ocessing instruction target matching "[xX][mM][lL]" is not allowed.


at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)


at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)


at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)


at org.mapsforge.map.writer.OSMTagMapping.(OSMTagMapping.java:122)


... 17 more

photo
0

Any help would be great.

photo
0

Anyone have any ideas?

photo
0

Hi Nick,


Please check your tag-mapping xml file (tag-mapping-shp.xml). It seems that there is some issue on first or second line of tour definition XML file. Maybe some empty lines or non-printed characters.

photo
0

What does the .xml file have to look like ?

photo
0

Can you provide a sample?

photo
0

Sample XML is available on the mentioned manual page http://docs.locusmap.eu/doku.php/manu...


There is a direct link for downloading: http://docs.locusmap.eu/doku.php/manu...

photo
0

I tried following that tutorial with those exact files and I had no success. Any ideas?

photo
0

Hi Nick,


Could be more specific, please? Can you also provide your result (generated map file) or maybe also the files needed for generation?


Thank you

photo
0

I am starting to explore gis and am still kind of a noob, so bear with me. I will try to explain what I want to do the best I can. I need to provide the ability to use the GIS Maps Offline, on a Nexus 7 Tablet. Basically, I would have a base map, and in addition to the base map I would need to have specific layers added to it, for example Village Fire Hydrants, Village Water Manholes, Village Houses, Village Streets, Village Boundary, Village Water Mains, Village Water Pumps, etc.... I have .shp files for each of these layers. I think I would probably get the best performance by using .map files for offline use. Do you think that is the best way? Also I would like to be able to click/touch a house for example on the map and view the address and even add like notes or a photo for that specific location and have it saved to a database or something. Would this be possible using locus? The map i would like to use as a base map is new_york.map. I downloaded this from http://vectormaps4locus.eu/America-Un....


I downloaded the New York vector map from there. This map works very well on locus, but I can not figure out how to get my other layers to work as well. Any help would be greatly appreciated. Thanks.

photo
0

Hello Nick,


Don’t worry we’ll try to help you.


So ...when you convert your SHP file into vector *.map format then you lost the ability to select point or get some metadata for converted points. So converting SHP files to the *.map is not good solution in your case.


It seems that your SHP files contain mainly data as points. From my point of view could be better to convert SHP file into KML files. If you import KML into Locus, you will be able to touch the point and see parametric data related with these points. Of course it depends how complex are your SHP file.


There is small tutorial how to convert small SHP file into KML file http://docs.locusmap.eu/doku.php/manu...


After that you can import KML file using standard Locus import function. http://docs.locusmap.eu/doku.php/manu...


What do you think?

photo
0

Can KML files be brought in as layers though? Or could I use a .kml file as a base map and then use .shp files for layers?

photo
0

I have tried loading a kml file into locus but it seems like the performance is not as good and is slower and not as responsive.

photo
0

that`s correct in case you have more lines/points. This is place where some more optimization is for sure needed ...

photo
0

Is there anyway to use layers in locus?

photo
0

If I provide you with a .shp file can you please try and convert it to .map?


I have not had any success in converting with osmosis. Maybe I am making an error somewhere.

photo
0

I tried making the kml...But when I try to import it into Locus, I get the following error:


Problem with file "Locus.kml"

photo
0

Is there anyway to attach a file here so you can check it out?

photo
0

Any help with this would be great.

photo
0

sorry nick


There are a lot of free web/ftp space, free upload services, free clouds,...


Feel free to search via google. Then upload your files and share it

photo
0

Ok. If I can get it uploaded in a location for you .. Could you possible help me out?

photo
0

Hello Nick,


Some tips from my site:


- As Menion wrote Locus is limited with handling of complex KML files. Is it possible to split SHP files into smaller parts before you convert them into KML files?


- Problem with file "Locus.kml” Locus supports almost all KML features. Please try to open problematic KML file in Google Earth and check if this file is opened properly.


- Unfortunately there is no way how to attach file to this topic. This is limitation of GetSatisfaction service.


- My favorite service for sharing files is http://sharegadget.com/ You can attach problematic KML files – I’ll check it.

photo
0

Hey Petr I have uploaded a .shp file in a zip at the following location using the service you recommended:


http://mysharegadget.com/786008826


Could you please let me know if you are able to convert this successfully to a .map.


Thanks.

photo
0

Hi Nick,


Is it possible to convert your SHP into map file. Converted file with XML definition files and style is placed in file: http://mysharegadget.com/162518213


COnverted map as overlay


photo
0

I have tried to convert to .map but was not successful. So you were able to ? I don`t understand why I was not able to. Could you explain what you needed to do?

photo
0

How did you convert it?

photo
0

When I try to add the .map file you provided to locus as an overlay I get a message saying:


"One vector file at a time or something like that."

photo
0

Any ideas?

photo
0

Locus is not able to set two vector maps as overlay. Please turn-off previous vector map which you use for overlay (Menu > More > Map overlay). Then select as base map arbitrary online or personal map. Run again map overlay function and select generated vector map.

photo
0

Hello Nick,


As you could see, is it possible to convert your SHP file into vector *.map format. So issue is not related with Locus.


If you still have some problem with generating own vector map, please visit official Mapsforge community site:


https://groups.google.com/forum/#!for...


On this forum you can directly contact developer of Mapsforge library and map


writer plugin for osmosis. I hope that they will be able to find out more about your issue.


Regards


Petr

photo
0

Can I use a vector map as a base map?

photo
0

Thank you for all the help Petr.

photo
0

Yes, you can.

photo
1

first...i cant update my locus pro...after that...i uninstalled it....then i try installed it again...but it appear the same error...


can u give me solution about this matter?

Replies have been locked on this page!