Point layer and zoom-in issues.

92 views
Skip to first unread message

RKannan

unread,
Jul 21, 2010, 4:07:48 PM7/21/10
to openscales-dev
Hi,

I am new to openscales. I am currently using version1.1.8.

I am using fxMap component and Mapnik to display OpenStreetMap. I read
longitude and latitude coordinates from back end and display them as
points on the map. The points are added to a layer and the layer is
added to the instance of map. The zoom level is set to 5 and
centerLonLat="-100, 40" for the map on initial Load.

There are two issues:

1. I zoom the map by using the mouse scroll. After 10 levels of
scrolling, the point that is under focus disappears. Till 9th stage of
zooming the point is visible. It disappears after that.

2. I have set Longitude and Latitude to x and y coordinates of the
point respectively. When the map is under zoom level 5, the points
displayed on the map are not located accurately. But as I zoom the
points are getting located accurately. Due to this issue, few points
are displayed in the ocean rather than the land area. Also, I see a
pattern while zoom-in and zoom-out happens.

While zooming in, all the points are moving south. Whereas while
zooming out the points are shifting towards North. For instance, if
there is a point near Jacksonville, FL while zooming in that point
moves to Gainesville, FL.

Could you please help me understand what is going wrong in the
application?

Thanks & Regards,
Rashmi.

bernard pavkovic

unread,
Jul 22, 2010, 4:01:51 AM7/22/10
to opensca...@googlegroups.com
For 1. issue I think that layer.generateResolutions(x) would solve the problem  - where layer is layer that you are drawing and x is max zoom level. For example:
var featureLayer:FeatureLayer = new FeatureLayer(...);
featureLayer.generateResolutions(20);

Regarding 2. issue I had similar problem when using custom markers, but it was do to my bad coding. So I don't relay know what's wrong in your case.


--
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.


RKannan

unread,
Jul 22, 2010, 6:58:43 PM7/22/10
to openscales-dev
Hi Bernard,

Looks like the first issue got resolved with the fix you gave.

Issue 2: Yep. I do understand there might be a problem with the
coding. But Openscales API documentation is not that helpful.
Could you suggest some other way to address this issue? If needed I
share the code.

Thanks & Regards,
Rashmi.

On Jul 22, 4:01 am, bernard pavkovic <bern...@gmail.com> wrote:
> For 1. issue I think that layer.generateResolutions(x) would solve the
> problem  - where layer is layer that you are drawing and x is max zoom
> level. For example:
> var featureLayer:FeatureLayer = new FeatureLayer(...);
> featureLayer.generateResolutions(20);
>
> Regarding 2. issue I had similar problem when using custom markers, but it
> was do to my bad coding. So I don't relay know what's wrong in your case.
>
> > openscales-de...@googlegroups.com<openscales-dev%2Bunsu...@googlegroups.com>
> > .

bernard pavkovic

unread,
Jul 23, 2010, 1:54:43 AM7/23/10
to opensca...@googlegroups.com
If this can help you :
I used custom marker (actually my college used it - since he is the one that created custom marker class and i extend it later). So in ours executeDrawing() method the code is like this (I think that is default code for OS - I don't want to bother and search it now :) )
var x:Number;
var y:Number;
var resolution:Number = this.layer.map.resolution
var dX:int = -int(this.layer.map.layerContainer.x) + this.left;
var dY:int = -int(this.layer.map.layerContainer.y) + this.top;
x = dX + point.x / resolution;
y = dY - point.y / resolution;


As you can see the pattern that you talk about is generated there (x and y change with resolution). Our problem was y displacement and it was due to the height of the marker. So in our draw method we had to make y decresment by the height of the display object we used to draw custom marker. At the end this code worked:
instance.y += y - (markerHeight+10);
where instance is display object we used to draw - it already has y coordinate due to drawing of it, y is the y coordinate generated in the code above, markerHeight is the height of our marker and +10 is offset.
I hope this helps :)

To unsubscribe from this group, send email to openscales-de...@googlegroups.com.

RKannan

unread,
Jul 23, 2010, 10:49:27 AM7/23/10
to openscales-dev
Hi,

The problem is with projection. I am using Mapnik that has projection
as EPSG:900913 and the layer's projection is EPSG:4326.
If this is resolved, I think the points will be positioned correctly.

Thanks,
Rashmi.

On Jul 23, 1:54 am, bernard pavkovic <bern...@gmail.com> wrote:
> If this can help you :
> I used custom marker (actually my college used it - since he is the one that
> created custom marker class and i extend it later). So in ours
> executeDrawing() method the code is like this (I think that is default code
> for OS - I don't want to bother and search it now :) )
> *var x:Number;
> var y:Number;
> var resolution:Number = this.layer.map.resolution
> var dX:int = -int(this.layer.map.layerContainer.x) + this.left;
> var dY:int = -int(this.layer.map.layerContainer.y) + this.top;
> x = dX + point.x / resolution;
> y = dY - point.y / resolution;*
>
> As you can see the pattern that you talk about is generated there (x and y
> change with resolution). Our problem was y displacement and it was due to
> the height of the marker. So in our draw method we had to make y decresment
> by the height of the display object we used to draw custom marker. At the
> end this code worked:
> *instance.y += y - (markerHeight+10);*
> where *instance* is display object we used to draw - it already has y
> coordinate due to drawing of it, *y* is the y coordinate generated in the
> code above, *markerHeight* is the height of our marker and *+10* is offset.
> I hope this helps :)
>
> > <openscales-dev%2Bunsu...@googlegroups.com<openscales-dev%252Buns...@googlegroups.com>

RKannan

unread,
Jul 23, 2010, 12:15:38 PM7/23/10
to openscales-dev
Hi,

Resolved the issue.
The problem was indeed with projection.
The map had different projection from the points and layer displayed
over the map.
I match the projection for the points and layers with that of the map.
This solved the issue.

POC:

//Transform lonlat coordinates to the projection of map.
lonlat.transform(new ProjProjection("EPSG:4326"), new
ProjProjection("EPSG:900913"));

//While creating layer, the layer's projection was set.
layer = new FeatureLayer("PrincetonLayer", false, true, "EPSG:
900913");

Since I used Mapnik, the projection by default is EPSG:900913.

Thank you bernard for your suggestion. Both the issues got resolved.

Regards,
Rashmi.

geogeek11

unread,
May 8, 2012, 1:47:51 PM5/8/12
to opensca...@googlegroups.com
hello,

i steel have the issue despite having the same projection in all map layers, i have tried reprojecting the server level and in client level but , have the same probleme , any advice will be very helpful :)
thanks in advance
Reply all
Reply to author
Forward
0 new messages