Jesse,
thank you very much for the hints. Shapefile (together
with the SLD) seems to be the solution as I want the pin to stay the same size
(instead of growing when zooming in).
I created the shapefile and the index file from a
program and took an existing dbf file (originally belonging to another shapefile
with the same number of features, as the ESRI specs don't have details about
it). It looks fine.
Michael
One pretty good way (but not the only way) is to make a shapefile
layer. Just a normal point layer. And you can add points to that
layer. To have the little pins show up you can create a SLD that uses your
gif to represent the points. This will allow all the pins to be persistent
and you can have thousands. Problems are that the image will stay the same
size always, or so I think. I seem to remember a patch that allows
the image to be scaleable but I don't remember if it is used by default of a
hint of some sort needs to be added. Benefits are that you have features
to play with so can add a lot of information to the layer.
Another option is to use a MapGraphic. A Map graphic is a very light
weight layer such as scalebar. It is quite easy to program as well.
A single draw(graphics2d) method that
For more information on any of these points just give me a shout,
Jesse
PS and example of the SLD style you would need for the point layer
is:
<?xml version="1.0" encoding="UTF-8"?>
<sld:UserLayer>
<sld:LayerFeatureConstraints>
<sld:FeatureTypeConstraint/>
</sld:LayerFeatureConstraints>
<sld:UserStyle>
<sld:Name>Hospitals by Continent</sld:Name>
<sld:Title>Default Styler</sld:Title>
<sld:Abstract></sld:Abstract>
<sld:FeatureTypeStyle>
<sld:Name>name</sld:Name>
<sld:Title>title</sld:Title>
<sld:Abstract>abstract</sld:Abstract>
<sld:FeatureTypeName>bc_hospitals</sld:FeatureTypeName>
<sld:SemanticTypeIdentifier>generic:geometry</sld:SemanticTypeIdentifier>
<sld:Rule>
<sld:Name>name</sld:Name>
<sld:Title>title</sld:Title>
<sld:Abstract>Abstract</sld:Abstract>
<sld:PointSymbolizer>
<sld:Graphic>
<sld:ExternalGraphic>
<sld:Format>image/png</sld:Format>
</sld:ExternalGraphic>
<sld:Opacity>
<ogc:Literal>1.0</ogc:Literal>
</sld:Opacity>
<sld:Size>
<ogc:Literal>32</ogc:Literal>
</sld:Size>
<sld:Rotation>
<ogc:Literal>0.0</ogc:Literal>
</sld:Rotation>
</sld:Graphic>
</sld:PointSymbolizer>
</sld:Rule>
</sld:FeatureTypeStyle>
</sld:UserStyle>
</sld:UserLayer>
</sld:StyledLayerDescriptor>
On 25-Oct-06, at 2:12 AM, Schneider, Michael wrote:
Hello!
Using uDIG 1.1 RC4 I want to mark certain places on
a map with a symbol, e.g. a pin. How can I do that
(programmatically)?
To do so I currently use gif files (small ones
showing a pin) and corresponding world files. Depending on the bounding box I
calculate the size of the pin (the gif) and specify the values in the world
file.
This works fine as long as no changes in the scale
are done. Zooming in causes the pins to grow, zooming out the pins shrink.
(While this is fine when marking areas this is not nice when you just want to
mark a certain place).
Isn't there a better way to mark one or more places
on a map?
Another problem occurred when I used my solution
for more than about 40 pins on one map (each pin gif has a size of less than 1
KB): I get a Java Heap Space error!
This happens when I do it from my program (plugin)
and it also happens when I use uDIG SDK in Eclipse 3.2.1 without any changes
and import the pins using the catalog.
This also happens with less than the 40 pins
mentioned above when I add let's say 20 pins, remove them from the project,
and add them once again. This results in the same heap space error (indicated
in the progress monitor).
I detected that behaviour when I tried to repaint
the pins with new values in the worldfile after zooming in; but this error
occures also when just adding, removing, and adding again the pins from the
catalog with no additional plugins.
Any hints or help welcome. Thank you.
Michael
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
|