Modify

Opened 3 years ago

Closed 18 months ago

Last modified 16 months ago

#5451 closed enhancement (fixed)

PicLayer calibration - GE .kml file support

Reported by: jp42@… Owned by: Larry0ua
Priority: normal Component: Plugin piclayer
Version: latest Keywords:
Cc:

Description (last modified by Larry0ua)

I have many images held in KML format as overlays. It would be helpful to store the PicLayer calibration information in a KML file. That would mean I could cut and paste KML data into the calibration file and the calibration would be ready to go. Likewise something calibrated in JOSM could be looked at in Google Earth.

See the two example files attached. They are the KML for and the cal file for, the same image (not supplied). They place the image in roughly the same location in GE and JOSM.

Attachments (3)

piclayer-proj.png (171.7 KB) - added by bastiK 18 months ago.
allee-sued-ba4-2_crop.kml (591 bytes) - added by thrap 16 months ago.
kml-file for Nidderau Bauabschnitt 4
allee-sued-ba4-2_crop.jpg (1.5 MB) - added by thrap 16 months ago.
jpg-file for Nidderau Bauabschnitt 4

Download all attachments as: .zip

Change History (20)

comment:1 Changed 3 years ago by jp42@…

TRAC says my files are SPAM, so sorry I could not upload them. Here they are: cal then kml

//-------------------------------------------------------------

#JOSM PicLayer plug-in calibration data
#Tue Sep 14 07:40:10 EST 2010
SCALEY=0.3479999999999994
INITIAL_SCALE=1164.9675295686193
SCALEX=0.4359999999999995
POSITION_Y=-37.82686094290884
POSITION_X=144.92064425132614
INITIAL_POS_y=-37.81863140486528
INITIAL_POS_X=144.9641153063133
ANGLE=1.2999999999999985

//-------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">

<GroundOverlay>
		<name>test_calibration</name>
		<visibility>1</visibility>
		<Icon>
			<href>test_calibration_image.png</href>
			<viewBoundScale>0.75</viewBoundScale>
		</Icon>
		<LatLonBox>
			<north>-37.76505587109686</north>
			<south>-37.88913530429822</south>
			<east>144.9867723342221</east>
			<west>144.8548541106736</west>
			<rotation>-1.326887403123449</rotation>
		</LatLonBox>
	</GroundOverlay>
</kml>

Last edited 18 months ago by bastiK (previous) (diff)

comment:2 Changed 3 years ago by stoecker

Solving the captcha and logging in would have helped for you file. Or you can add it as zip archive.

comment:3 Changed 18 months ago by Larry0ua

  • Description modified (diff)
  • Owner changed from team to Larry0ua
  • Status changed from new to assigned
  • Summary changed from Calibration file as kml to allow calibration by cut and paste to PicLayer calibration - GE .kml file support

comment:4 Changed 18 months ago by bastiK

@Larry0ua:

I understand the reference like this:

  • first move the image into the given bounding box
  • then rotate counterclockwise by the given angle about the center of the image

Could be done by the following algorithm:

  • convert lat/lon box to east/north box [x1,y1,x2,y2]
  • build affine transformation:
    • scale by ((x2-x1)/w, (y2-y1)/h)
      (w - image width in px, h - image height)
    • rotate
    • move by east/north value of center point (x1+(x2-x1)/2, y1+(y2-y1)/2)

As a first step, there should be a movement by (-w/2, -h/2), but I think this is already implied in the piclayer algorithm:

 g.drawImage( image, -image.getWidth(null) / 2, -image.getHeight(null) / 2, null );

comment:5 Changed 18 months ago by Larry0ua

  • Resolution set to fixed
  • Status changed from assigned to closed

Now KML is supported for PicLayer and ready for testing. Please post any unsupported or badly calibrated KMLs here. [o27231]

In supported I mean:
[+] opening KML with LatLonBox is OK
[+] multiimage KML is supported
[-] saving is not implemented (I see gx:LatLonQuad as something to work on, but may be later - have no idea about how to read such because that is not affine in general - I can convert to, but cannot convert from).

Changed 18 months ago by bastiK

comment:6 Changed 18 months ago by bastiK

There are problems with large images in projections other than Mercator and WGS84.


I noticed, that google earth would really reproject the image (to fit the red quadrilateral) and even make the upper and lower edges curved (to follow the line of constant latitude).

We should seriously look for a library that can do more than affine transformation. One candidate would be GeoTools.

comment:7 Changed 18 months ago by bastiK

There is a typo in the reader: "rotate" should be "rotation"

comment:8 Changed 18 months ago by bastiK

Whish: support for kmz files.

comment:9 Changed 18 months ago by Larry0ua

rotation - fixed.
kmz - hope to have it in the future, as using it too, and it does not look harder than kml (just zip with kml and images inside)
about reporjection... really not easy stuff, needs investigation

comment:11 Changed 18 months ago by stoecker

Ooops Zip, then see trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java, which also supports Zip-File including images.

Last edited 18 months ago by stoecker (previous) (diff)

comment:12 Changed 18 months ago by Larry0ua

@stoecker, actually there is support of zip in PicLayer so it will be not a problem :)

comment:13 Changed 18 months ago by stoecker

Zip itself is no problem, true. But the core has already a "get the image for me and don't bother me with the real place" functionality including zip support.

comment:14 Changed 18 months ago by baditaflorin@…

If i could load kml or kmz with picture inside it would be perfect :)

And dynamic kml like these

<?xml version="1.0" encoding="utf-8"?>
<kml xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://www.opengis.net/kml/2.2">
  <NetworkLink>
    <open>1</open>
    <name>Demographics/ESRI_Population_World</name>
    <LookAt>
      <longitude>-1.47523492544022</longitude>
      <latitude>11.8018794035218</latitude>
      <range>28241154.7596751</range>
    </LookAt>
    <Region>
      <LatLonAltBox>
        <north>90</north>
        <south>-90</south>
        <east>180</east>
        <west>-180</west>
      </LatLonAltBox>
      <Lod>
        <minLodPixels>128</minLodPixels>
        <maxLodPixels>-1</maxLodPixels>
      </Lod>
    </Region>
    <Url>
      <viewRefreshMode>onStop</viewRefreshMode>
      <viewRefreshTime>2</viewRefreshTime>
      <href>http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Population_World/MapServer/export</href>
      <viewFormat>f=kmz&amp;bboxSR=4326&amp;imageSR=4326&amp;transparent=true&amp;bbox=[bboxWest],[bboxSouth],[bboxEast],[bboxNorth]&amp;size=[horizPixels],[vertPixels]&amp;</viewFormat>
    </Url>
  </NetworkLink>
</kml>  
Last edited 18 months ago by bastiK (previous) (diff)

Changed 16 months ago by thrap

kml-file for Nidderau Bauabschnitt 4

Changed 16 months ago by thrap

jpg-file for Nidderau Bauabschnitt 4

comment:15 follow-up: Changed 16 months ago by thrap

regarding Nidderau Bauabschnitt 4 / allee-sued-ba4-2_crop:

I received a map from city government for a new residential aerea in our city. In Google Earth I put in in the right place and dimension. From the kmz-file I extracted the kml and changed the path (cancel "/file/").

In JOSM using piclayer the import worked but the map was shown bigger than it should be, I would say 3 times.

I's a pitty that this useful function doesn't work.

Thomas

comment:16 in reply to: ↑ 15 Changed 16 months ago by thrap

Replying to thrap:

regarding Nidderau Bauabschnitt 4 / allee-sued-ba4-2_crop:

I received a map from city government for a new residential aerea in our city. In Google Earth I put in in the right place and dimension. From the kmz-file I extracted the kml and changed the path (cancel "/file/").

In JOSM using piclayer the import worked but the map was shown bigger than it should be, I would say 3 times.

I's a pitty that this useful function doesn't work.

Thomas

I found out the right way to change the dimension of the map. Everything fine! wonderful tool.
Thomas

comment:17 Changed 16 months ago by Larry0ua

May you share your information or/and kmz?

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed .
as The resolution will be set. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.