ThinkGeo.com    |     Documentation    |     Premium Support

How do I select respective layers?

Hi,


I am quite new to map suite so I hope I can get some help.


I am able to move one InMemoryLayer when I right click on it or in fact anywhere on the map(where anywhere on the map isn't going to cut it), a context menu pops up where I select "move point" where after I select a new point on the map where it is then moved to/ redrawn.


The problem is that i have about thirty respective InMemoryFeatureLayers which when I right click the pointshape I want it selected to move it. How do I select the respective layers when I click on them?


Thanks



Can you give us a little more background on the application you are working on? I would like to back up a little bit before jumping on giving you the solution for your case. I am wondering why you are using so many InMemoryFeatureLayers. What are they used for? What do they represent? How many features do you have per InMemoryFeatureLayer? I want to make sure with you that you are correctly using the InMemoryFeatureLayers before delving into the exact solution for your case. The ideal would be to have from you a little sample we can run and see if you apprach your situation in an efficient way.


 Also, i let you know that recently, we published a project, Dragging Icon,  in the Code Community that shows how to select a point feature and drag it using the same InMemoryFeatureLayer. Althought, it is a little bit different from what you are trying to accomplish, I suggest you check it out.


code.thinkgeo.com/projects/show/draggingicon


 



Thanks for the reply.


The features is simple pointshapes that represents "train/s". When a driver logs on and enters his details and location the application reads it from a local database and plots the train/s on the map hence the various InMemoryFeatureLayers. On refresh the locations of the trains are read to update the trains' position/s. if there is network problems and the database isn't updated or the updated location is incorrect  the driver must be able to move the train manually which then updates the local database from his side. There's only one feature per layer. The deadline is due soon, an exact solution woud be very much appreciated.


 


Thank you I'll check out the link



 Thank you for giving us more explications on what your app is going to require.


 For refreshing the trains positions, we have various samples in the Code Community that show how to do that for cars.  For example, you can check out the following samples:


-Moving Vehicle with Labelcode.thinkgeo.com/projects/s...hiclelabel


-Side View Iconcode.thinkgeo.com/projects/show/sideviewicon


-Vehicle Directioncode.thinkgeo.com/projects/show/vehicledirection


 


 For moving manually the train, I think that the best sample is Dragging Icon code.thinkgeo.com/projects/show/draggingicon as I mentioned before. And, I would recommend using the same InMemoryFeatureLayer for easier maintenance for all the different vehicle as it is done in the sample Dragging Icon. Use a ValueStyle to display differently the various vehicles.


 I think that by combining the techniques found in those different samples, you can reach your goal for your application. Thank you.



Thanks i got it working

You are welcome. Any other doubts or questions, let us know.

Val Thanks for your help. Jaco, I am glad you got it. 



Any more questions just feel free to let me know. 



Thanks. 



Yale 

 




Hi Yale,


If I would like to use the another feature layer instead...


I know how to select the layer when i pass it's name through, but how can i get the name when i click on the point shape?


I want to declare a variable which will then take the point shapes name after I clicked on it and pass it through the code I use that moves the pointshape.


Can i post both of the above mentioned pieces of code for you?


thank you!


 





 Jaco, 
  
 Thanks for your post and question. 
  
 If I am not misunderstanding anything, what you are trying to do when you mouse down on the map control, you want to get the name of the feature?  
  
 In fact, not only the name of the feature, you could get any information stored in the feature in advance. I think basically following steps needed to execute this: first, find the layer you want to do query on. Second, based on the layer and mouse down position, do a query to find out those features you are interested.  Third, when you do query on step2, please pass in those column names you are interested, probably names if you are interested. 
  
 Any more questions just feel free to let me know. 
  
 Thanks. 
  
 Yale