CustomMarker class displays at wrong coordinates

115 views
Skip to first unread message

hdam

unread,
Jan 27, 2012, 5:02:27 PM1/27/12
to openscales-dev
Hi,

I use CustomMarker class to create circle features for my custom
layer. They're rendered fine, but at the wrong coordinate, any
pointers on what's happening are much appreciated, my code ...

cirMarker.graphics.beginFill(0x00FFCC);
cirMarker.graphics.drawCircle(0, 0, radius);
feature = CustomMarker.createDisplayObjectMarker(cirMarker,
location);

Thanks - H

Hadrien TULIPE

unread,
Jan 28, 2012, 7:00:56 AM1/28/12
to opensca...@googlegroups.com
Hi,

We experienced some issues with features and their projection being erroneous. We made changes that may fix your problem. Unfortunatly, those changes are not yet released, though we plan to release soon. Keep posted.

Cheers


Hadrien Tulipe


2012/1/27 hdam <hda...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "openscales-dev" group.
To post to this group, send email to opensca...@googlegroups.com.
To unsubscribe from this group, send email to openscales-de...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/openscales-dev?hl=en.


hdam

unread,
Jan 30, 2012, 12:30:55 PM1/30/12
to openscales-dev
Hi,

Thanks, if you could provide the source of the potential fix, I will
merge it locally, test, then post the result.

Thx - H

Hadrien TULIPE

unread,
Jan 30, 2012, 4:24:14 PM1/30/12
to opensca...@googlegroups.com
Well best you could do is get the source from bitbucket https://bitbucket.org/gis/openscales/src and build the source.

Cheers


Hadrien Tulipe


2012/1/30 hdam <hda...@gmail.com>

hdam

unread,
Jan 31, 2012, 2:43:10 PM1/31/12
to openscales-dev
Hi,

I download the latest source via hg clone https://bitbucket.org/gis/openscales

I modify the SampleLayers.as in the openscales-fx-examples project for
testing. However, it seems the problem is still unresolved - the
point feature is not at the center of the custom marker's circle
feature. Following is my test code...

point = new org.openscales.geometry.Point(4.89713, 45.81965);
layer.addFeature(new PointFeature(point,null,style));

var cirMarker:Sprite = new Sprite();
var feature:Feature;
var location:Location = new Location(4.89713, 45.81965, "EPSG:
4326");

cirMarker.graphics.beginFill(0x00FFCC);
cirMarker.graphics.drawCircle(0, 0, 20);
feature = CustomMarker.createDisplayObjectMarker(cirMarker,
location);
feature.alpha = 0.3;
layer.addFeature(feature);

In addition, there seems to be an issue with
PointFeature.createPointFeature. The following code doesn't display
the point feature.


layer.addFeature(PointFeature.createPointFeature(location));

Any ideas?

Thanks - H

On Jan 30, 4:24 pm, Hadrien TULIPE <hadrientul...@gmail.com> wrote:
> Well best you could do is get the source from bitbuckethttps://bitbucket.org/gis/openscales/srcand build the source.

Maxime Viry

unread,
Feb 1, 2012, 5:01:15 AM2/1/12
to opensca...@googlegroups.com
Hi,

The custom marker is not displayed properly because there is a built-in mechanism that shift the custom marker sprite by width/2 and height/2. You are drawing your circle with it's center at 0,0 in the sprite so the center of your marker is already properly placed.

You have two solutions. You can create your custom marker with an offset given in the constructor :
feature = CustomMarker.createDisplayObjectMarker(cirMarker,location,null,cirMarker.width/2, cirMarker.height/2);

or  you can change the center of the circle while drawing it :
cirMarker.graphics.drawCircle(20, 20, 20);

With the createPointFeature method you need to set a style to your feature like that :

layer.addFeature(PointFeature.createPointFeature(location, null, style));

I have also just fixed a bug with this method when you are not using a location in "EPSG:4326".

like that you will have your point at the center of the circle. (Well.. almost it seams that the black square used pour pointFeature style is not shifted properly, you can use Style.getDefaultPointStyle() as a Style. It my be a bug, we will soon work on the Styles in Openscales and will look forward into that)

I hope this will help you.
Regards,
Viry Maxime

hdam

unread,
Feb 1, 2012, 1:54:19 PM2/1/12
to openscales-dev
Hi,

Many thanks, it works. Any ideas why would the built-in mechanism
have the location shifted by default?

I think that in 1.2.1, PointFeature.createPointFeature() will use
Style.getDefaultPointStyle() if you
don't supply the style parameter.

Thanks for looking into this.

-H

Maxime Viry

unread,
Feb 1, 2012, 1:56:31 PM2/1/12
to opensca...@googlegroups.com
Hi,
Custom markers are working like that because when you set an image it will be automatically shifted properly.

Regards,
Viry Maxime

evanl

unread,
Jan 30, 2012, 7:02:37 PM1/30/12
to openscales-dev
Guys,
I think I'm running into a similar issue with co-ordinate system
location reporting for the current mouse position.
What I've noticed is that co-ordinates as they appear reported in
decimal degrees in OpenScales (including in the current web based
demo) are not accurate.
For example, positions reported in the web demo (I'm using the Legal
Informations Sample), do not match the actual position the mouse is
over.
I've built OpenScales test apps using v2.0 and v1.2 respectively, I'm
seeing the same behaviour in both.
I can set the map.center attribute with long/lat values of a known
exact location, and I'm seeing the same amount of error occuring with
this approach also.
There is an older implementation of OpenScales available online that
does work as expected, this can be found at:
http://flexmappers.com/openscalessolution
If I navigate manually to the same locations in this example, the
decimal co-ordinates are reported as expected.
If you can confirm that what I'm seeing is a result of the same bug
you're currently working, I'd be happy to have this confirmed thanks
(I can rule myself out of the equation at least :)
Thanks - Evan


On Jan 31, 8:24 am, Hadrien TULIPE <hadrientul...@gmail.com> wrote:
> Well best you could do is get the source from bitbuckethttps://bitbucket.org/gis/openscales/srcand build the source.
Reply all
Reply to author
Forward
0 new messages