NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

Hi all,

I am trying to make a standalone flash OSM viewer, and had no problems compiling etc. I am stuck on what flash variables to use to set the path to load a osm file, instead of loading from the OSM api. I have found on potlatch 2 related websites that loading from an OSM file is a feature, but how do I do it? There doesn't seem to be any documentation anywhere on what parameters can be passed in. Thanks!

fo.addVariable("lat",51.875);
fo.addVariable("lon",-1.482);
fo.addVariable("zoom",14);
fo.addVariable("api","http://www.openstreetmap.org/api/0.6/");
fo.addVariable("policy","http://www.openstreetmap.org/api/crossdomain.xml");
fo.addVariable("connection","AMF");
fo.addVariable("responder","respond");
fo.addVariable("tileurl","http://npe.openstreetmap.org/$z/$x/$y.png");
fo.addVariable("style","stylesheets/openskimap.css");
fo.addVariable("show_debug","true");
fo.write("map");

asked 04 Mar '11, 05:07

wbski's gravatar image

wbski
1466914
accept rate: 50%


You need to set the connection type to "OSM" instead of "AMF", and you need to name your files with the bounding box that they cover.

For example,

 fo.addVariable("api","http://127.0.0.1/~richard/potlatch2");       // base URL
 fo.addVariable("connection","OSM");
 fo.addVariable("files","-1.5_-1.4_52.1_52.2.osm");

You can provide a comma-separated list of .osm files if you have more than one. Halcyon will then load from whichever files are relevant for the area that is being shown. You'll also need a crossdomain.xml file to authorise flash to load the files - put it in the same directory or a parent directory, and load it with the "policy" setting.

The "OSM" connection isn't a very well tested part of the code, so you may find a few bugs with it. If you find any bugs please report them on trac.

permanent link

answered 04 Mar '11, 09:49

Andy%20Allan's gravatar image

Andy Allan
12.5k23128153
accept rate: 28%

edited 04 Mar '11, 09:56

What do you mean with: '"OSM" connection isn't a very well tested part of the code' care to expand?

(04 Mar '11, 09:57) emj

I mean that part of the code that loads standalone OSM files isn't very well tested - I'm not aware of anyone using it other than RichardF quite some time ago. The "XML" connection type, however, is used thoroughly so we know that it works well.

(04 Mar '11, 11:07) Andy Allan

That works fine. Is there any way I could do this without renaming all my OSM files? After all, the bounding box data is already at the top of the osm file: <bound box="49.34000,-123.26000,49.46000,-123.14000" origin="Osmosis SNAPSHOT-rexported"/> I could easily pass in the bbox through the flash variables as well. Thanks!!

(04 Mar '11, 16:42) wbski

Hmm, I think I might have found a bug.. fo.addVariable("style","stylesheets/simple.css"); Doesn't load the mapcss.. If I just paste the css into the textbox on the side (same html as geowiki), it works fine. It doesn't seem to load on the geowiki page either, until someone clicks refresh css.. http://www.geowiki.com/halcyon/ Should I file a bug or do you think I am doing something wrong here?

(04 Mar '11, 17:01) wbski

Suggest you file a bug.

(05 Mar '11, 12:21) Richard ♦

I found an option called files in P2 code, it seems to take a comma seperated list of.osm files.

Other options I found in P2 source:

api
connection
files
force_auth
gpx
gpx_url
locale
maximise_function
minimise_function
move_function
nocache
oauth_access_url
oauth_auth_url
oauth_consumer_key
oauth_consumer_secret
oauth_policy
oauth_request_url
oauth_token
oauth_token_secret
policy
responder
serverName
show_debug
show_help
site_name
style
tile_resolution
tileurl
permanent link

answered 04 Mar '11, 09:24

emj's gravatar image

emj
2.0k123547
accept rate: 15%

edited 04 Mar '11, 09:58

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×210
×15
×1

question asked: 04 Mar '11, 05:07

question was seen: 4,349 times

last updated: 05 Mar '11, 12:21

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum